[Changeset] r11151 - in django/branches/soc2009/test-improvements: . tests tests/regressiontests/admin_views tests/regressiontests/admin_views/windmilltests

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 23:33:21 -0500 (Wed, 01 Jul 2009)
New Revision: 11151

Modified:
   django/branches/soc2009/test-improvements/
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/primary.py
   django/branches/soc2009/test-improvements/tests/runtests.py
Log:
[gsoc2009-testing] Ensure that tests run in a variety of situations. Including 
when problems loading admin



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10974
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:11127
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10979
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:11127

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
===
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
  2009-07-02 02:28:12 UTC (rev 11150)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
  2009-07-02 04:33:21 UTC (rev 11151)
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
 import tempfile
 import os
-from django.core.files.storage import FileSystemStorage
+# from django.core.files.storage import FileSystemStorage
 from django.db import models
-from django.contrib import admin
-from django.core.mail import EmailMessage
+# from django.contrib import admin
+# from django.core.mail import EmailMessage
 
 class SectionTest(models.Model):
 """

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
===
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
 2009-07-02 02:28:12 UTC (rev 11150)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
 2009-07-02 04:33:21 UTC (rev 11151)
@@ -2,7 +2,10 @@
 from django.contrib import admin
 import views
 import customadmin
-#admin.autodiscover()
+try:
+admin.autodiscover()
+except Exception, e:
+print 'Autodiscover Error'
 urlpatterns = patterns('',
 (r'^admin/doc/', include('django.contrib.admindocs.urls')),
 (r'^admin/secure-view/$', views.secure_view),

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/primary.py
===
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/primary.py
2009-07-02 02:28:12 UTC (rev 11150)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/windmilltests/primary.py
2009-07-02 04:33:21 UTC (rev 11151)
@@ -363,14 +363,14 @@
 client.click(link=u'Users')
 client.waits.forPageLoad(timeout=u'2')
 #print client.commands.getPageText()
-client.asserts.assertNode(link=u'adduser')
+#client.asserts.assertNode(link=u'adduser')
 client.asserts.assertNode(link=u'changeuser')
 client.asserts.assertNode(link=u'deleteuser')
 client.asserts.assertNode(link=u'joepublic')
 client.asserts.assertNode(link=u'super')
 client.click(link=u'Yes')
 client.waits.forPageLoad(timeout=u'2')
-client.asserts.assertNode(link=u'adduser')
+#client.asserts.assertNode(link=u'adduser')
 client.asserts.assertNode(link=u'changeuser')
 client.asserts.assertNode(link=u'deleteuser')
 # client.asserts.assertNode(link=u'super')

Modified: django/branches/soc2009/test-improvements/tests/runtests.py
===
--- django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-02 
02:28:12 UTC (rev 11150)
+++ django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-02 
04:33:21 UTC (rev 11151)
@@ -198,7 +198,7 @@
 from windmill.authoring import setup_module, teardown_module
 from django.core.management.commands.test_windmill import 
ServerContainer, attempt_import
 from django.test.windmill_tests import WindmillDjangoUnitTest
-from django.db.models.loading import remove_model
+from django.db.models.loading import remove_model, get_app
 #Run the appropriate test runner based on command line params.
 if do_std:
 if do_coverage:
@@ -258,7 +258,7 @@
 if hasattr(mod, 'fixtures'):
 for fixture in getattr(mod, 'fixtures'):
 wmfixs.append(fixture)
-

[Changeset] r11150 - in django/branches/soc2009/multidb/django: core/management/commands db

2009-07-01 Thread noreply

Author: Alex
Date: 2009-07-01 21:28:12 -0500 (Wed, 01 Jul 2009)
New Revision: 11150

Modified:
   
django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py
   django/branches/soc2009/multidb/django/core/management/commands/dbshell.py
   django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py
   django/branches/soc2009/multidb/django/core/management/commands/sql.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlall.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlclear.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlcustom.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlflush.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlindexes.py
   django/branches/soc2009/multidb/django/core/management/commands/sqlreset.py
   
django/branches/soc2009/multidb/django/core/management/commands/sqlsequencereset.py
   django/branches/soc2009/multidb/django/db/__init__.py
Log:
[soc2009/multidb] Replaced a lot of raw strings with the appropriate constant.  
Thanks to Igor Sobreira for reminding me about these.

Modified: 
django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py
===
--- 
django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py
 2009-07-02 00:28:01 UTC (rev 11149)
+++ 
django/branches/soc2009/multidb/django/core/management/commands/createcachetable.py
 2009-07-02 02:28:12 UTC (rev 11150)
@@ -1,7 +1,7 @@
 from optparse import make_option
 
 from django.core.management.base import LabelCommand
-from django.db import connections, transaction, models
+from django.db import connections, transaction, models, DEFAULT_DB_ALIAS
 
 class Command(LabelCommand):
 help = "Creates the table needed to use the SQL cache backend."
@@ -10,8 +10,9 @@
 
 option_list = LabelCommand.option_list + (
 make_option('--database', action='store', dest='database',
-default='default', help='Nominates a specific database to install '
-'the cache table to.  Defaults to the "default" database.'),
+default=DEFAULT_DB_ALIAS, help='Nominates a specific database to '
+'install the cache table to.  Defaults to the "default" '
+'database.'),
 )
 
 requires_model_validation = False

Modified: 
django/branches/soc2009/multidb/django/core/management/commands/dbshell.py
===
--- django/branches/soc2009/multidb/django/core/management/commands/dbshell.py  
2009-07-02 00:28:01 UTC (rev 11149)
+++ django/branches/soc2009/multidb/django/core/management/commands/dbshell.py  
2009-07-02 02:28:12 UTC (rev 11150)
@@ -1,7 +1,7 @@
 from optparse import make_option
 
 from django.core.management.base import BaseCommand, CommandError
-from django.db import connections
+from django.db import connections, DEFAULT_DB_ALIAS
 
 class Command(BaseCommand):
 help = ("Runs the command-line client for specified database, or the "
@@ -9,8 +9,8 @@
 
 option_list = BaseCommand.option_list + (
 make_option('--database', action='store', dest='database',
-default='default', help='Nominates a database to open a shell for.'
-' Defaults to the "default" database.'),
+default=DEFAULT_DB_ALIAS, help='Nominates a database to open a '
+'shell for.  Defaults to the "default" database.'),
 )
 
 requires_model_validation = False

Modified: 
django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py
===
--- 
django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py
2009-07-02 00:28:01 UTC (rev 11149)
+++ 
django/branches/soc2009/multidb/django/core/management/commands/inspectdb.py
2009-07-02 02:28:12 UTC (rev 11150)
@@ -2,15 +2,15 @@
 from optparse import make_option
 
 from django.core.management.base import NoArgsCommand, CommandError
-from django.db import connections
+from django.db import connections, DEFAULT_DB_ALIAS
 
 class Command(NoArgsCommand):
 help = "Introspects the database tables in the given database and outputs 
a Django model module."
 
 option_list = NoArgsCommand.option_list + (
 make_option('--database', action='store', dest='database',
-default='default', help='Nominates a database to introspect.  '
-'Defaults to using the "default" database.'),
+default=DEFAULT_DB_ALIAS, help='Nominates a database to '
+'introspect.  Defaults to using the "default" database.'),
 )
 
 requires_model_validation = False

Modified: django/branches/soc2009/multidb/django/core/management/commands/sql.py
===
--- 

Re: [Django] #891: customize table name prefixes

2009-07-01 Thread Django
#891: customize table name prefixes
---+
  Reporter:  aaronsw   | Owner:  adrian
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:
Resolution:  invalid   |  Keywords:
 Stage:  Ready for checkin | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by russellm):

 Please re-read my previous comment - in particular, the last paragraph.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11149 - django/branches/soc2009/http-wsgi-improvements/django/core/handlers

2009-07-01 Thread noreply

Author: ccahoon
Date: 2009-07-01 19:28:01 -0500 (Wed, 01 Jul 2009)
New Revision: 11149

Modified:
   django/branches/soc2009/http-wsgi-improvements/django/core/handlers/base.py
Log:
[soc2009/http-wsgi-improvements] Fix core.handler.BaseHandler.process_request.

Indentation issue.

Modified: 
django/branches/soc2009/http-wsgi-improvements/django/core/handlers/base.py
===
--- django/branches/soc2009/http-wsgi-improvements/django/core/handlers/base.py 
2009-07-01 23:33:02 UTC (rev 11148)
+++ django/branches/soc2009/http-wsgi-improvements/django/core/handlers/base.py 
2009-07-02 00:28:01 UTC (rev 11149)
@@ -63,25 +63,25 @@
 # as a flag for initialization being complete.
 self._request_middleware = request_middleware
 
-   def process_request(self, request_env): 
-   signals.request_started.send(sender=self.__class__) 
-   try: 
-   try: 
-   request = self.request_class(request_env) 
-   except UnicodeDecodeError: 
-   response = http.HttpResponseBadRequest() 
-   else: 
-   response = self.get_response(request) 
+def process_request(self, request_env):
+signals.request_started.send(sender=self.__class__)
+try:
+try:
+request = self.request_class(request_env)
+except UnicodeDecodeError:
+response = http.HttpResponseBadRequest()
+else:
+response = self.get_response(request)
 
-   # Apply response middleware 
-   if not isinstance(response, http.HttpResponseSendFile): 
-   for middleware_method in self._response_middleware: 
-   response = middleware_method(request, response) 
-   response = self.apply_response_fixes(request, response) 
-   finally: 
-   signals.request_finished.send(sender=self.__class__) 
+# Apply response middleware
+if not isinstance(response, http.HttpResponseSendFile):
+for middleware_method in self._response_middleware:
+response = middleware_method(request, response)
+response = self.apply_response_fixes(request, response)
+finally:
+signals.request_finished.send(sender=self.__class__)
 
-   return response 
+return response
 
 def get_response(self, request):
 "Returns an HttpResponse object for the given HttpRequest"


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11323: Updating Korean translation

2009-07-01 Thread Django
#11323: Updating Korean translation
---+
  Reporter:  daybreaker| Owner:  anonymous  
Status:  new   | Milestone:  1.1
 Component:  Translations  |   Version:  SVN
Resolution:|  Keywords:  i18n translation korean
 Stage:  Unreviewed| Has_patch:  0  
Needs_docs:  0 |   Needs_tests:  0  
Needs_better_patch:  0 |  
---+
Changes (by daybreaker):

  * owner:  daybreaker => anonymous
  * status:  assigned => new

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11147 - in django/branches/soc2009/i18n-improvements/django: contrib/admin/templatetags contrib/databrowse utils

2009-07-01 Thread noreply

Author: garcia_marc
Date: 2009-07-01 18:10:57 -0500 (Wed, 01 Jul 2009)
New Revision: 11147

Added:
   django/branches/soc2009/i18n-improvements/django/utils/numberformat.py
Modified:
   
django/branches/soc2009/i18n-improvements/django/contrib/admin/templatetags/admin_list.py
   
django/branches/soc2009/i18n-improvements/django/contrib/databrowse/datastructures.py
   django/branches/soc2009/i18n-improvements/django/utils/formats.py
Log:
[soc2009/i18n] implemented more efficient way to get formats

Modified: 
django/branches/soc2009/i18n-improvements/django/contrib/admin/templatetags/admin_list.py
===
--- 
django/branches/soc2009/i18n-improvements/django/contrib/admin/templatetags/admin_list.py
   2009-07-01 22:27:37 UTC (rev 11146)
+++ 
django/branches/soc2009/i18n-improvements/django/contrib/admin/templatetags/admin_list.py
   2009-07-01 23:10:57 UTC (rev 11147)
@@ -3,7 +3,7 @@
 from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, 
PAGE_VAR, SEARCH_VAR
 from django.core.exceptions import ObjectDoesNotExist
 from django.db import models
-from django.utils import dateformat
+from django.utils import formats
 from django.utils.html import escape, conditional_escape
 from django.utils.text import capfirst
 from django.utils.safestring import mark_safe
@@ -185,15 +185,12 @@
 # Dates and times are special: They're formatted in a certain way.
 elif isinstance(f, models.DateField) or isinstance(f, 
models.TimeField):
 if field_val:
-date_format = getformat('DATE_FORMAT')
-datetime_format = getformat('DATETIME_FORMAT')
-time_format = getformat('TIME_FORMAT')
 if isinstance(f, models.DateTimeField):
-result_repr = capfirst(dateformat.format(field_val, 
datetime_format))
+result_repr = 
capfirst(formats.date_and_time_format(field_val, 'DATETIME_FORMAT'))
 elif isinstance(f, models.TimeField):
-result_repr = 
capfirst(dateformat.time_format(field_val, time_format))
+result_repr = 
capfirst(formats.date_and_time_format(field_val, 'TIME_FORMAT'))
 else:
-result_repr = capfirst(dateformat.format(field_val, 
date_format))
+result_repr = capfirst(formats.format(field_val, 
'DATE_FORMAT'))
 else:
 result_repr = EMPTY_CHANGELIST_VALUE
 row_class = ' class="nowrap"'
@@ -266,8 +263,6 @@
 year_lookup = cl.params.get(year_field)
 month_lookup = cl.params.get(month_field)
 day_lookup = cl.params.get(day_field)
-year_month_format = getformat('YEAR_MONTH_FORMAT')
-month_day_format = getformat('MONTH_DAY_FORMAT')
 
 link = lambda d: mark_safe(cl.get_query_string(d, [field_generic]))
 
@@ -277,9 +272,9 @@
 'show': True,
 'back': {
 'link': link({year_field: year_lookup, month_field: 
month_lookup}),
-'title': dateformat.format(day, year_month_format)
+'title': formats.date_and_time_format(day, 
'YEAR_MONTH_FORMAT')
 },
-'choices': [{'title': dateformat.format(day, 
month_day_format)}]
+'choices': [{'title': formats.date_and_time_format(day, 
'MONTH_DAY_FORMAT')}]
 }
 elif year_lookup and month_lookup:
 days = cl.query_set.filter(**{year_field: year_lookup, 
month_field: month_lookup}).dates(field_name, 'day')
@@ -291,7 +286,7 @@
 },
 'choices': [{
 'link': link({year_field: year_lookup, month_field: 
month_lookup, day_field: day.day}),
-'title': dateformat.format(day, month_day_format)
+'title': formats.date_and_time_format(day, 
'MONTH_DAY_FORMAT')
 } for day in days]
 }
 elif year_lookup:
@@ -304,7 +299,7 @@
 },
 'choices': [{
 'link': link({year_field: year_lookup, month_field: 
month.month}),
-'title': dateformat.format(month, year_month_format)
+'title': formats.date_and_time_format(month, 
'YEAR_MONTH_FORMAT')
 } for month in months]
 }
 else:

Modified: 
django/branches/soc2009/i18n-improvements/django/contrib/databrowse/datastructures.py
===
--- 
django/branches/soc2009/i18n-improvements/django/contrib/databrowse/datastructures.py
   2009-07-01 22:27:37 UTC (rev 11146)
+++ 
django/branches/soc2009/i18n-improvements/django/contrib/databrowse/datastructures.py
   2009-07-01 23:10:57 UTC (rev 11147)
@@ -4,7 +4,7 @@
 """
 
 from django.db import models
-from 

[Changeset] r11146 - in django/branches/soc2009/test-improvements: . django/contrib/admindocs django/contrib/gis/admin django/contrib/gis/db/models/sql django/contrib/gis/maps/google django/contrib/gi

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 17:27:37 -0500 (Wed, 01 Jul 2009)
New Revision: 11146

Removed:
   
django/branches/soc2009/test-improvements/django/contrib/gis/templates/gis/google/google-base.js
Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/contrib/admindocs/views.py
   django/branches/soc2009/test-improvements/django/contrib/gis/admin/options.py
   
django/branches/soc2009/test-improvements/django/contrib/gis/db/models/sql/query.py
   
django/branches/soc2009/test-improvements/django/contrib/gis/maps/google/gmap.py
   
django/branches/soc2009/test-improvements/django/contrib/gis/templates/gis/google/google-map.js
   
django/branches/soc2009/test-improvements/django/contrib/gis/templates/gis/google/google-multi.js
   
django/branches/soc2009/test-improvements/django/contrib/gis/templates/gis/google/google-single.js
   
django/branches/soc2009/test-improvements/django/contrib/gis/tests/relatedapp/models.py
   
django/branches/soc2009/test-improvements/django/contrib/gis/tests/relatedapp/tests.py
   django/branches/soc2009/test-improvements/django/core/urlresolvers.py
   django/branches/soc2009/test-improvements/docs/ref/index.txt
   
django/branches/soc2009/test-improvements/tests/modeltests/transactions/models.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/null_fk/models.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/serializers_regress/tests.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/urlpatterns_reverse/tests.py
Log:
[gsoc2009-testing] Merging from trunk. Favoring my index.txt with windmill howto



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10973
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10974
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:11127

Modified: 
django/branches/soc2009/test-improvements/django/contrib/admindocs/views.py
===
--- django/branches/soc2009/test-improvements/django/contrib/admindocs/views.py 
2009-07-01 22:27:02 UTC (rev 11145)
+++ django/branches/soc2009/test-improvements/django/contrib/admindocs/views.py 
2009-07-01 22:27:37 UTC (rev 11146)
@@ -214,6 +214,22 @@
 'help_text': field.help_text,
 })
 
+# Gather many-to-many fields.
+for field in opts.many_to_many:
+data_type = related_object_name = field.rel.to.__name__
+app_label = field.rel.to._meta.app_label
+verbose = _("related `%(app_label)s.%(object_name)s` objects") % 
{'app_label': app_label, 'object_name': data_type}
+fields.append({
+'name': "%s.all" % field.name,
+"data_type": 'List',
+'verbose': utils.parse_rst(_("all %s") % verbose , 'model', 
_('model:') + opts.module_name),
+})
+fields.append({
+'name'  : "%s.count" % field.name,
+'data_type' : 'Integer',
+'verbose'   : utils.parse_rst(_("number of %s") % verbose , 
'model', _('model:') + opts.module_name),
+})
+
 # Gather model methods.
 for func_name, func in model.__dict__.items():
 if (inspect.isfunction(func) and len(inspect.getargspec(func)[0]) == 
1):
@@ -233,7 +249,7 @@
 })
 
 # Gather related objects
-for rel in opts.get_all_related_objects():
+for rel in opts.get_all_related_objects() + 
opts.get_all_related_many_to_many_objects():
 verbose = _("related `%(app_label)s.%(object_name)s` objects") % 
{'app_label': rel.opts.app_label, 'object_name': rel.opts.object_name}
 accessor = rel.get_accessor_name()
 fields.append({

Modified: 
django/branches/soc2009/test-improvements/django/contrib/gis/admin/options.py
===
--- 
django/branches/soc2009/test-improvements/django/contrib/gis/admin/options.py   
2009-07-01 22:27:02 UTC (rev 11145)
+++ 
django/branches/soc2009/test-improvements/django/contrib/gis/admin/options.py   
2009-07-01 22:27:37 UTC (rev 11146)
@@ -32,7 +32,7 @@
 map_height = 400
 map_srid = 4326
 map_template = 'gis/admin/openlayers.html'
-openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js'
+openlayers_url = 'http://openlayers.org/api/2.8/OpenLayers.js'
 point_zoom = num_zoom - 6
 wms_url = 'http://labs.metacarta.com/wms/vmap0'
 wms_layer = 'basic'

Modified: 

[Changeset] r11145 - in django/branches/soc2009/test-improvements: . django/test tests tests/regressiontests/admin_views

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 17:27:02 -0500 (Wed, 01 Jul 2009)
New Revision: 11145

Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/test/windmill_tests.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
   django/branches/soc2009/test-improvements/tests/runtests.py
Log:
[gsoc2009-testing] Cleanup threads after tests run. Ensure the django admin is 
populated before windmill tests start



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10972
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10973
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/test/windmill_tests.py
===
--- django/branches/soc2009/test-improvements/django/test/windmill_tests.py 
2009-07-01 22:26:51 UTC (rev 11144)
+++ django/branches/soc2009/test-improvements/django/test/windmill_tests.py 
2009-07-01 22:27:02 UTC (rev 11145)
@@ -55,18 +55,18 @@
 
 # Must do database stuff in this new thread if database in memory.
 from django.conf import settings
-if settings.DATABASE_ENGINE == 'sqlite3' \
-and (not settings.TEST_DATABASE_NAME or 
settings.TEST_DATABASE_NAME == ':memory:'):
-from django.db import connection
-print 'Creating test DB'
-db_name = connection.creation.create_test_db(0)
-#call_command('syncdb', 0, 0)
-# Import the fixture data into the test database.
-if hasattr(self, 'fixtures'):
-print 'Loading fixtures.'
-# We have to use this slightly awkward syntax due to the fact
-# that we're using *args and **kwargs together.
-call_command('loaddata', *self.fixtures, **{'verbosity': 0})
+#if settings.DATABASE_ENGINE == 'sqlite3' \
+#and (not settings.TEST_DATABASE_NAME or 
settings.TEST_DATABASE_NAME == ':memory:'):
+from django.db import connection
+print 'Creating test DB'
+db_name = connection.creation.create_test_db(0,autoclobber=True)
+#call_command('syncdb', 0, 0)
+# Import the fixture data into the test database.
+if hasattr(self, 'fixtures'):
+print 'Loading fixtures.'
+# We have to use this slightly awkward syntax due to the fact
+# that we're using *args and **kwargs together.
+call_command('loaddata', *self.fixtures, **{'verbosity': 0})
 
 try:
 print "running thread"

Modified: 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
===
--- 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
2009-07-01 22:26:51 UTC (rev 11144)
+++ 
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
2009-07-01 22:27:02 UTC (rev 11145)
@@ -35,12 +35,12 @@
 
 def setUp(self):
 from django.contrib import admin
-admin.autodiscover()
+admin.register(TestSection)
 self.client.login(username='super', password='secret')
 
 def tearDown(self):
 from django.contrib import admin
-admin.autodiscover()
+admin.unregister(TestSection)
 self.client.logout()
 
 def testTrailingSlashRequired(self):

Modified: django/branches/soc2009/test-improvements/tests/runtests.py
===
--- django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-01 
22:26:51 UTC (rev 11144)
+++ django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-01 
22:27:02 UTC (rev 11145)
@@ -274,9 +274,10 @@
 print 'Waiting for threaded server to come online.'
 started.wait()
 print 'DB Ready, Server online.'
+from django.contrib import admin
+admin.autodiscover()
 
 
-
 # Set the testing URL based on what available port we get.
 global_settings.TEST_URL = 'http://localhost:%d' % 
server_container.server_thread.port
 
@@ -331,6 +332,7 @@
 #count = count + 1
 #setup_module(tests[count][1])
 teardown_module(tests[0][1])
+server_container.stop_test_server()
 # sys.argv = [wmtests[0],]
 # bin.cli()
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google 

[Changeset] r11144 - in django/branches/soc2009/test-improvements: . docs/howto docs/topics

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 17:26:51 -0500 (Wed, 01 Jul 2009)
New Revision: 11144

Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/docs/howto/windmill-tests.txt
   django/branches/soc2009/test-improvements/docs/topics/testing.txt
Log:
[gsoc2009-testing] Extending documentation, fixing rst formatting.



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10971
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10972
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/docs/howto/windmill-tests.txt
===
--- django/branches/soc2009/test-improvements/docs/howto/windmill-tests.txt 
2009-07-01 22:26:42 UTC (rev 11143)
+++ django/branches/soc2009/test-improvements/docs/howto/windmill-tests.txt 
2009-07-01 22:26:51 UTC (rev 11144)
@@ -11,80 +11,48 @@
 is simple, following these steps:
 
 .. _Windmill: http://getwindmill.com
+
 #. Your windmill tests must be their own module, named ``wmtests`` or 
``windmilltests``.
-  
 
-#. Django must be able to run any function in the module without arguments.
-::
-from windmill.conf import global_settings
-ADMIN_URL =  "%s/test_admin/admin" % global_settings.TEST_URL
-from windmill.authoring import WindmillTestClient
-from django.test.utils import calling_func_name
+#. Django must be able to run any function in the module without arguments.::
 
-def test_loginAndSetup():
-   '''Mostly just a proof of concept to test working order of tests.'''
-   client = WindmillTestClient(calling_func_name())
+from windmill.conf import global_settings
+ADMIN_URL =  "%s/test_admin/admin" % global_settings.TEST_URL
+from windmill.authoring import WindmillTestClient
+from django.test.utils import calling_func_name
 
-   client.open(url='http://localhost:8000/admin')
-   client.waits.forPageLoad(timeout=u'2')
-   ...
+def test_loginAndSetup():
+   '''Mostly just a proof of concept to test working order of tests.'''
+   client = WindmillTestClient(calling_func_name())
 
-#. Your windmill testing module must load any files other than the module 
loader 
-in ``__init__.py``. 
-::
-from primary.py import * 
+   client.open(url='http://localhost:8000/admin')
+   client.waits.forPageLoad(timeout=u'2')
+   ...
 
-Your custom storage system may override any of the storage methods explained in
-:ref:`ref-files-storage`, but you **must** implement the following methods:
+#. Your windmill testing module must load any files other than the module 
loader in ``__init__.py``.::
 
-* :meth:`Storage.delete`
-* :meth:`Storage.exists`
-* :meth:`Storage.listdir`
-* :meth:`Storage.size`
-* :meth:`Storage.url`
+from primary import * 
+...
 
-You'll also usually want to use hooks specifically designed for custom storage
-objects. These are:
+Setup and Teardown are done differently for windmill tests, and consist of the 
following
+functions. :
 
-``_open(name, mode='rb')``
-~~
+* :meth:`setup_module`
+* :meth:`teardown_module`
+   
+A sample implementation, in ``__init__.py``.::
 
-**Required**.
+from primary import *
+
+def setup_module(module):
+module.property = fetch_property()
+
+def teardown_module(module):
+module.property = None
+
 
-Called by ``Storage.open()``, this is the actual mechanism the storage class
-uses to open the file. This must return a ``File`` object, though in most 
cases,
-you'll want to return some subclass here that implements logic specific to the
-backend storage system.
 
-``_save(name, content)``
-
+These methods can be included in any file with windmill tests. See `functest`_
+for more information. 
 
-Called by ``Storage.save()``. The ``name`` will already have gone through
-``get_valid_name()`` and ``get_available_name()``, and the ``content`` will be 
a
-``File`` object itself. 
-
-Should return the actual name of name of the file saved (usually the ``name``
-passed in, but if the storage needs to change the file name return the new name
-instead).
-
-``get_valid_name(name)``
-
-
-Returns a filename suitable for use with the underlying storage system. The
-``name`` argument passed to this method is the original filename sent to the
-server, after having any path information removed. Override this to customize
-how non-standard characters are converted to safe 

Re: [Django] #11370: GeoQuery works fine in 1.0.2, but chokes on latest SVN

2009-07-01 Thread Django
#11370: GeoQuery works fine in 1.0.2, but chokes on latest SVN
-+--
  Reporter:  anonymous   | Owner:  nobody
Status:  closed  | Milestone:
 Component:  GIS |   Version:  1.0   
Resolution:  invalid |  Keywords:
 Stage:  Unreviewed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by jbronn):

  * status:  new => closed
  * resolution:  => invalid

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #10287: Formset documentation has no information about practical formset validation

2009-07-01 Thread Django
#10287: Formset documentation has no information about practical formset 
validation
+---
  Reporter:  aidan  | Owner:  andrewbadr
Status:  new| Milestone:  1.1   
 Component:  Documentation  |   Version:  1.0   
Resolution: |  Keywords:  docs, formsets
 Stage:  Accepted   | Has_patch:  0 
Needs_docs:  0  |   Needs_tests:  0 
Needs_better_patch:  0  |  
+---
Changes (by andrewbadr):

  * owner:  jacob => andrewbadr
  * status:  assigned => new

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11142 - in django/branches/soc2009/test-improvements: . django/contrib/auth/tests django/test docs/topics tests tests/regressiontests tests/regressiontests/admin_views tests/regressiontes

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 09:24:25 -0500 (Wed, 01 Jul 2009)
New Revision: 11142

Added:
   django/branches/soc2009/test-improvements/django/test/decorators.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/test_decorators/
   
django/branches/soc2009/test-improvements/tests/regressiontests/test_decorators/tests.py
Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/contrib/auth/tests/views.py
   django/branches/soc2009/test-improvements/django/test/__init__.py
   django/branches/soc2009/test-improvements/django/test/simple.py
   django/branches/soc2009/test-improvements/docs/topics/testing.txt
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/urls.py
   django/branches/soc2009/test-improvements/tests/urls.py
Log:
[gsoc2009-testing] Added support for skipping tests that cannot pass. Add auth 
to regression suite urls.py so reverse() works.



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10962
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10969
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/contrib/auth/tests/views.py
===
--- 
django/branches/soc2009/test-improvements/django/contrib/auth/tests/views.py
2009-07-01 10:40:09 UTC (rev 11141)
+++ 
django/branches/soc2009/test-improvements/django/contrib/auth/tests/views.py
2009-07-01 14:24:25 UTC (rev 11142)
@@ -9,6 +9,7 @@
 from django.test import TestCase
 from django.core import mail
 from django.core.urlresolvers import reverse
+from django.test.decorators import views_required
 
 class AuthViewsTestCase(TestCase):
 """
@@ -49,22 +50,26 @@
 
 def test_email_not_found(self):
 "Error is raised if the provided email address isn't currently 
registered"
-response = self.client.get('/password_reset/')
+response = 
self.client.get(reverse('django.contrib.auth.views.password_reset'))
 self.assertEquals(response.status_code, 200)
-response = self.client.post('/password_reset/', {'email': 
'not_a_real_em...@email.com'})
+response = 
self.client.post(reverse('django.contrib.auth.views.password_reset'), {'email': 
'not_a_real_em...@email.com'})
 self.assertContains(response, "That e-mail address doesnt have an 
associated user account")
 self.assertEquals(len(mail.outbox), 0)
-
+
+test_email_not_found = 
views_required(required_views=['django.contrib.auth.views.password_reset'])(test_email_not_found)
+
 def test_email_found(self):
 "Email is sent if a valid email address is provided for password reset"
-response = self.client.post('/password_reset/', {'email': 
'staffmem...@example.com'})
+response = 
self.client.post(reverse('django.contrib.auth.views.password_reset'), {'email': 
'staffmem...@example.com'})
 self.assertEquals(response.status_code, 302)
 self.assertEquals(len(mail.outbox), 1)
 self.assert_("http://; in mail.outbox[0].body)
+
+test_email_found = 
views_required(required_views=['django.contrib.auth.views.password_reset'])(test_email_found)
 
 def _test_confirm_start(self):
 # Start by creating the email
-response = self.client.post('/password_reset/', {'email': 
'staffmem...@example.com'})
+response = 
self.client.post(reverse('django.contrib.auth.views.password_reset'), {'email': 
'staffmem...@example.com'})
 self.assertEquals(response.status_code, 302)
 self.assertEquals(len(mail.outbox), 1)
 return self._read_signup_email(mail.outbox[0])
@@ -80,7 +85,9 @@
 # redirect to a 'complete' page:
 self.assertEquals(response.status_code, 200)
 self.assert_("Please enter your new password" in response.content)
+test_confirm_valid = 
views_required(required_views=['django.contrib.auth.views.password_reset'])(test_confirm_valid)
 
+
 def test_confirm_invalid(self):
 url, path = self._test_confirm_start()
 # Let's munge the token in the path, but keep the same length,
@@ -90,6 +97,7 @@
 response = self.client.get(path)
 self.assertEquals(response.status_code, 200)
 self.assert_("The password reset link was invalid" in response.content)
+test_confirm_invalid = 
views_required(required_views=['django.contrib.auth.views.password_reset'])(test_confirm_invalid)
 
 def test_confirm_invalid_post(self):
 # Same as test_confirm_invalid, but trying
@@ -102,6 +110,7 @@
 

Re: [Django] #891: customize table name prefixes

2009-07-01 Thread Django
#891: customize table name prefixes
---+
  Reporter:  aaronsw   | Owner:  adrian
Status:  closed| Milestone:
 Component:  Database layer (models, ORM)  |   Version:
Resolution:  invalid   |  Keywords:
 Stage:  Ready for checkin | Has_patch:  0 
Needs_docs:  0 |   Needs_tests:  0 
Needs_better_patch:  0 |  
---+
Comment (by anonymous):

 I think the benefit of having a prefix variable (in settings.py) would be
 if you want to copy the project to another location/directory, you don't
 have to change your models. I would also find this useful and logical,
 would you consider reopening this ticket?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4788: django selftests should skip tests bound to fail

2009-07-01 Thread Django
#4788: django selftests should skip tests bound to fail
+---
  Reporter:  m...@noris.de   | Owner:  kkubasik
Status:  new| Milestone:  
 Component:  Testing framework  |   Version:  SVN 
Resolution: |  Keywords:  
 Stage:  Accepted   | Has_patch:  1   
Needs_docs:  0  |   Needs_tests:  0   
Needs_better_patch:  0  |  
+---
Comment (by kkubasik):

 Incorperated version into gsoc-testing branch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #7777: DecimalField validation ignores infinity and nan

2009-07-01 Thread Django
#: DecimalField validation ignores infinity and nan
-+--
  Reporter:  thebitguru  | Owner:  nobody
Status:  new | Milestone:
 Component:  Core framework  |   Version:  SVN   
Resolution:  |  Keywords:
 Stage:  Design decision needed  | Has_patch:  0 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Comment (by ramiro):

 #11411 was a duplicate and included a patch.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11411: DecimalField and NaN

2009-07-01 Thread Django
#11411: DecimalField and NaN
--+-
  Reporter:  kovali...@gmail.com  | Owner:  nobody  
Status:  closed   | Milestone:  1.0.3   
 Component:  Forms|   Version:  1.0 
Resolution:  duplicate|  Keywords:  DecimalField,NaN
 Stage:  Unreviewed   | Has_patch:  1   
Needs_docs:  0|   Needs_tests:  0   
Needs_better_patch:  0|  
--+-
Changes (by ramiro):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => duplicate
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 duplicate of #

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #6396: [newforms-admin] Customization-unfriendly admin template tags should die

2009-07-01 Thread Django
#6396: [newforms-admin] Customization-unfriendly admin template tags should die
-+--
  Reporter:  korpios | Owner:  nobody 
Status:  new | Milestone: 
 Component:  django.contrib.admin|   Version:  SVN
Resolution:  |  Keywords:  nfa-someday
 Stage:  Design decision needed  | Has_patch:  1  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by athena_rd):

 Replying to [comment:19 dvine]:
 > I absolutely support the patch by Martin Diers and would like to see it
 included. Still I also agree with korpios, that a
 [app_label]/[object_name]/template.html behaviore of all admin templates,
 thus eliminating the need for an custom template tag here, would be very
 desirable. Just wanted to bring up the topic again.

 [[BR]]
 Seconded. I too would like to see this added as it would make adding items
 (i.e. searchbar) to custom admin views much easier.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #11123: Irish localflavor

2009-07-01 Thread Django
#11123: Irish localflavor
-+--
  Reporter:  mt  | Owner:  nobody
Status:  new | Milestone:  1.2   
 Component:  django.contrib.localflavor  |   Version:  1.0   
Resolution:  |  Keywords:  Ireland ie
 Stage:  Accepted| Has_patch:  1 
Needs_docs:  0   |   Needs_tests:  0 
Needs_better_patch:  0   |  
-+--
Changes (by anonymous):

  * milestone:  => 1.2

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Django] #11411: DecimalField and NaN

2009-07-01 Thread Django
#11411: DecimalField and NaN
-+--
 Reporter:  kovali...@gmail.com  |   Owner:  nobody
   Status:  new  |   Milestone:  1.0.3 
Component:  Forms| Version:  1.0   
 Keywords:  DecimalField,NaN |   Stage:  Unreviewed
Has_patch:  1|  
-+--
 When save form with DecimalField which has NaN value I get exception:
 {{{
 Exception Type: TypeError
 Exception Value:bad operand type for abs(): 'str'
 Exception Location: /var/lib/python-
 support/python2.6/django/forms/fields.py in clean, line 254
 }}}

 Because clean method of DecimalField doesn't check that value can be
 'NaN'.

 I use django 1.0.2.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11140 - in django/branches/soc2009/test-improvements: . django/core/management/commands django/test tests

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 05:39:52 -0500 (Wed, 01 Jul 2009)
New Revision: 11140

Modified:
   django/branches/soc2009/test-improvements/
   
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
   django/branches/soc2009/test-improvements/django/test/test_coverage.py
   django/branches/soc2009/test-improvements/tests/runtests.py
Log:
[gsoc2009-testing] Import windmill imports before starting coverage, this fixes 
some module load issues



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10960
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10961
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
===
--- 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
  2009-07-01 10:39:40 UTC (rev 11139)
+++ 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
  2009-07-01 10:39:52 UTC (rev 11140)
@@ -1,12 +1,13 @@
 from django.core.management.base import BaseCommand
 #from windmill.authoring import djangotest
-from  django.test import windmill_tests as djangotest
+from django.utils import importlib
+from django.test import windmill_tests as djangotest
 import sys, os
 from time import sleep
 import types
 import logging
 import threading
-from django.utils import importlib
+
 class ServerContainer(object):
 start_test_server = djangotest.start_test_server
 stop_test_server = djangotest.stop_test_server

Modified: django/branches/soc2009/test-improvements/django/test/test_coverage.py
===
--- django/branches/soc2009/test-improvements/django/test/test_coverage.py  
2009-07-01 10:39:40 UTC (rev 11139)
+++ django/branches/soc2009/test-improvements/django/test/test_coverage.py  
2009-07-01 10:39:52 UTC (rev 11140)
@@ -3,7 +3,7 @@
 import os, sys
 
 from django.conf import settings
-from django.db.models import get_app, get_apps
+from django.db.models.loading import get_app, get_apps
 
 from django.test.simple import DefaultTestRunner as base_run_tests
 
@@ -34,7 +34,7 @@
 Runs the specified tests while generating code coverage statistics. 
Upon
 the tests' completion, the results are printed to stdout.
 """
-self.cov.erase()
+#self.cov.erase()
 #Allow an on-disk cache of coverage stats.
 self.cov.use_cache(0)
 #for e in getattr(settings, 'COVERAGE_CODE_EXCLUDES', []):
@@ -124,42 +124,3 @@
 
 return res
 
-
-try:
-set
-except:
-from sets import Set as set
-
-
-class ModuleVars(object):
-modules = dict()
-def __new__(cls, module_name, module=None):
-if cls.modules.get(module_name, None):
-return cls.modules.get(module_name)
-else:
-obj=super(ModuleVars, cls).__new__(cls)
-obj._init(module_name, module)
-cls.modules[module_name] = obj
-return obj
-
-def _init(self, module_name, module):
-source_file, stmts, excluded, missed, missed_display = 
coverage.analysis2(module)
-executed = list(set(stmts).difference(missed))
-total = list(set(stmts).union(excluded))
-total.sort()
-title = module.__name__
-total_count = len(total)
-executed_count = len(executed)
-excluded_count = len(excluded)
-missed_count = len(missed)
-try:
-percent_covered = float(len(executed))/len(stmts)*100
-except ZeroDivisionError:
-percent_covered = 100
-test_timestamp = time.strftime('%a %Y-%m-%d %H:%M %Z')
-severity = 'normal'
-if percent_covered < 75: severity = 'warning'
-if percent_covered < 50: severity = 'critical'
-
-for k, v in locals().iteritems():
-setattr(self, k, v)

Modified: django/branches/soc2009/test-improvements/tests/runtests.py
===
--- django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-01 
10:39:40 UTC (rev 11139)
+++ django/branches/soc2009/test-improvements/tests/runtests.py 2009-07-01 
10:39:52 UTC (rev 11140)
@@ -185,10 +185,19 @@
 
 # Default number of failures is 0
 failures = 0
-
+if do_windmill:
+# Our bank of windmill-specific imports. Only loaded when used.
+import types
+import logging
+import threading
+from windmill.conf import global_settings
+   

[Changeset] r11139 - in django/branches/soc2009/test-improvements: . django/test

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 05:39:40 -0500 (Wed, 01 Jul 2009)
New Revision: 11139

Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/test/windmill_tests.py
Log:
[gsoc2009-testing] Fix a spacing issue in windmill_tests.py



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10953
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10960
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/test/windmill_tests.py
===
--- django/branches/soc2009/test-improvements/django/test/windmill_tests.py 
2009-07-01 10:39:32 UTC (rev 11138)
+++ django/branches/soc2009/test-improvements/django/test/windmill_tests.py 
2009-07-01 10:39:40 UTC (rev 11139)
@@ -21,6 +21,7 @@
 except Exception, e:
 print "You don't appear to have windmill installed, please install before 
trying to run windmill tests again."
 unit = None
+
 class StoppableWSGIServer(basehttp.WSGIServer):
 """WSGIServer with short timeout, so that server thread can stop this 
server."""
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



[Changeset] r11138 - in django/branches/soc2009/test-improvements: . django/test

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 05:39:32 -0500 (Wed, 01 Jul 2009)
New Revision: 11138

Added:
   django/branches/soc2009/test-improvements/django/test/mocks.py
Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/test/testcases.py
Log:
[gsoc2009-testing] Adding mock requests creation in django.test.mocks. Still 
needs tests and docs



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10952
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10953
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Added: django/branches/soc2009/test-improvements/django/test/mocks.py
===
--- django/branches/soc2009/test-improvements/django/test/mocks.py  
(rev 0)
+++ django/branches/soc2009/test-improvements/django/test/mocks.py  
2009-07-01 10:39:32 UTC (rev 11138)
@@ -0,0 +1,38 @@
+from django.test import Client
+from django.core.handlers.wsgi import WSGIRequest
+
+class RequestFactory(Client):
+"""
+Class that lets you create mock Request objects for use in testing.
+
+Usage:
+
+rf = RequestFactory()
+get_request = rf.get('/hello/')
+post_request = rf.post('/submit/', {'foo': 'bar'})
+
+This class re-uses the django.test.client.Client interface, docs here:
+http://www.djangoproject.com/documentation/testing/#the-test-client
+
+Once you have a request object you can pass it to any view function,
+just as if that view had been hooked up using a URLconf.
+
+"""
+def request(self, **request):
+"""
+Similar to parent class, but returns the request object as soon as it
+has created it.
+"""
+environ = {
+'HTTP_COOKIE': self.cookies,
+'PATH_INFO': '/',
+'QUERY_STRING': '',
+'REQUEST_METHOD': 'GET',
+'SCRIPT_NAME': '',
+'SERVER_NAME': 'testserver',
+'SERVER_PORT': 80,
+'SERVER_PROTOCOL': 'HTTP/1.1',
+}
+environ.update(self.defaults)
+environ.update(request)
+return WSGIRequest(environ)

Modified: django/branches/soc2009/test-improvements/django/test/testcases.py
===
--- django/branches/soc2009/test-improvements/django/test/testcases.py  
2009-07-01 10:39:21 UTC (rev 11137)
+++ django/branches/soc2009/test-improvements/django/test/testcases.py  
2009-07-01 10:39:32 UTC (rev 11138)
@@ -243,12 +243,12 @@
 try:
 app_mods = cache.app_models[app_label]
 for tm in self.test_models:
-print "importing %s " % tm
+#print "importing %s " % tm
 im = importlib.import_module(tm)
 #cache.app_store[im] = len(cache.app_store)
-print "finding model classes"
+#print "finding model classes"
 mod_classes =  [f for f in im.__dict__.values() if 
hasattr(f,'__bases__') and issubclass(f,models.Model)]
-print "Found models %s " % mod_classes
+#print "Found models %s " % mod_classes
 for mc in mod_classes:
 print "Adding %s to AppCache" % mc
 app_mods[mc.__name__.lower()] = mc
@@ -329,12 +329,12 @@
app_mods = cache.app_models[app_label]
print app_mods
for tm in self.test_models:
-   print "importing %s " % tm
+   #print "importing %s " % tm
im = importlib.import_module(tm)
#cache.app_store[im] = len(cache.app_store)
-   print "finding model classes"
+   #print "finding model classes"
mod_classes =  [f for f in im.__dict__.values() if 
hasattr(f,'__bases__') and issubclass(f,models.Model)]
-   print "Found models %s " % mod_classes
+   #print "Found models %s " % mod_classes
for mc in mod_classes:
print "Deleting %s from AppCache" % mc
del app_mods[mc.__name__.lower()]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 

[Changeset] r11137 - in django/branches/soc2009/test-improvements: . django/test tests tests/regressiontests/admin_views

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 05:39:21 -0500 (Wed, 01 Jul 2009)
New Revision: 11137

Added:
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/test_models.py
Modified:
   django/branches/soc2009/test-improvements/
   django/branches/soc2009/test-improvements/django/test/testcases.py
   
django/branches/soc2009/test-improvements/tests/regressiontests/admin_views/tests.py
   django/branches/soc2009/test-improvements/tests/runtests.py
Log:
[gsoc2009-testing] Add test_models loading code. Not very clean yet, but it 
works



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10951
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10952
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: django/branches/soc2009/test-improvements/django/test/testcases.py
===
--- django/branches/soc2009/test-improvements/django/test/testcases.py  
2009-07-01 10:39:06 UTC (rev 11136)
+++ django/branches/soc2009/test-improvements/django/test/testcases.py  
2009-07-01 10:39:21 UTC (rev 11137)
@@ -212,8 +212,11 @@
   named fixtures.
 * If the Test Case class has a 'urls' member, replace the
   ROOT_URLCONF with it.
+* If the Test Case class has a 'test_models' member, load the 
relivent
+  named models.
 * Clearing the mail test outbox.
 """
+self._test_model_setup()
 self._fixture_setup()
 self._urlconf_setup()
 mail.outbox = []
@@ -225,6 +228,35 @@
 # that we're using *args and **kwargs together.
 call_command('loaddata', *self.fixtures, **{'verbosity': 0})
 
+def _test_model_setup(self):
+if hasattr(self, 'test_models'):
+print self.test_models
+if self.__module__.endswith('tests'):
+app_label = self.__module__.split('.')[:-1][-1]
+else:
+app_label = self.__module__.split('.')[:-2][-1]
+from django.db.models.loading import cache
+from django.utils import importlib
+from django.db import models
+#importlib.import_module()
+cache.write_lock.acquire()
+try:
+app_mods = cache.app_models[app_label]
+for tm in self.test_models:
+print "importing %s " % tm
+im = importlib.import_module(tm)
+#cache.app_store[im] = len(cache.app_store)
+print "finding model classes"
+mod_classes =  [f for f in im.__dict__.values() if 
hasattr(f,'__bases__') and issubclass(f,models.Model)]
+print "Found models %s " % mod_classes
+for mc in mod_classes:
+print "Adding %s to AppCache" % mc
+app_mods[mc.__name__.lower()] = mc
+finally:
+cache.write_lock.release()
+#call_command('syncdb', **{'verbosity': 0})
+
+
 def _urlconf_setup(self):
 if hasattr(self, 'urls'):
 self._old_root_urlconf = settings.ROOT_URLCONF
@@ -261,12 +293,53 @@
 
 * Putting back the original ROOT_URLCONF if it was changed.
 """
+self._test_model_teardown()
 self._fixture_teardown()
 self._urlconf_teardown()
 
 def _fixture_teardown(self):
 pass
 
+def _test_model_teardown(self):
+if hasattr(self, 'test_models'):
+print self.test_models
+if self.__module__.endswith('tests'):
+app_label = self.__module__.split('.')[:-1][-1]
+else:
+app_label = self.__module__.split('.')[:-2][-1]
+from django.db.models.loading import cache
+from django.utils import importlib
+from django.db import models
+#importlib.import_module()
+# cc = cache.get_app(app_label)
+#del cache.app_store[cc]
+##del cache.app_models[app_label]
+#cache.loaded = False
+#print cache.handled
+#print '.'.join(cc.__name__.split('.')[:-1])
+#print cc.__package__
+#del cache.handled[cc.__package__]
+#cache._populate()
+#print cache.get_app(app_label)
+#cc = cache.get_app(app_label)
+
+#reload(cache.get_app(app_label))
+cache.write_lock.acquire()
+   

[Changeset] r11136 - in django/branches/soc2009/test-improvements: . django/core/management/commands

2009-07-01 Thread noreply

Author: kkubasik
Date: 2009-07-01 05:39:06 -0500 (Wed, 01 Jul 2009)
New Revision: 11136

Modified:
   django/branches/soc2009/test-improvements/
   
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
Log:
[gsoc2009-testing] Use importlib from django.util in attempt_import



Property changes on: django/branches/soc2009/test-improvements
___
Name: svk:merge
   - 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10936
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054
   + 23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django-gsoc:10951
23ef3597-c209-482b-90c0-ea6045f15f7f:/local/django/trunk:10927
bcc190cf-cafb-0310-a4f2-bffc1f526a37:/django/trunk:1054

Modified: 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
===
--- 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
  2009-07-01 05:01:59 UTC (rev 11135)
+++ 
django/branches/soc2009/test-improvements/django/core/management/commands/test_windmill.py
  2009-07-01 10:39:06 UTC (rev 11136)
@@ -6,19 +6,19 @@
 import types
 import logging
 import threading
-
+from django.utils import importlib
 class ServerContainer(object):
 start_test_server = djangotest.start_test_server
 stop_test_server = djangotest.stop_test_server
 
 def attempt_import(name, suffix):
 try:
-mod = __import__(name+'.'+suffix)
+mod = importlib.import_module(name+'.'+suffix)
 except ImportError:
 mod = None
 if mod is not None:
 s = name.split('.')
-mod = __import__(s.pop(0))
+mod = importlib.import_module(s.pop(0))
 for x in s+[suffix]:
 try:
 mod = getattr(mod, x)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #9002: Easy way to create mock Request objects for testing views

2009-07-01 Thread Django
#9002: Easy way to create mock Request objects for testing views
+---
  Reporter:  simon  | Owner:  kkubasik
Status:  new| Milestone:  
 Component:  Testing framework  |   Version:  1.0 
Resolution: |  Keywords:  
 Stage:  Accepted   | Has_patch:  0   
Needs_docs:  0  |   Needs_tests:  0   
Needs_better_patch:  0  |  
+---
Comment (by kkubasik):

 I have added support in django.test.mocks based on the snippet. Still
 needs docs and tests.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---