#17882: regressiontests.admin_filters fails with pyscopg2 when USE_TZ is False
----------------------------------------------+--------------------
     Reporter:  brodie                        |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  SVN
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 With these settings:

 {{{#!python
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'djangotest',
         'USER': 'djangotest',
         'PASSWORD': 'djangotest',
     },
     'other': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
         'NAME': 'djangotestother',
         'USER': 'djangotestother',
         'PASSWORD': 'djangotestother',
     }
 }

 SECRET_KEY = "django_tests_secret_key"
 }}}

 Running the admin_filters test from trunk (at [17682]) fails when testing
 time zone support:

 {{{
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 ....E...........
 ======================================================================
 ERROR: test_datefieldlistfilter_with_time_zone_support
 (regressiontests.admin_filters.tests.ListFiltersTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "django/django/test/utils.py", line 214, in inner
     return test_func(*args, **kwargs)
   File "django/tests/regressiontests/admin_filters/tests.py", line 227, in
 test_datefieldlistfilter_with_time_zone_support
     self.test_datefieldlistfilter()
   File "django/tests/regressiontests/admin_filters/tests.py", line 146, in
 test_datefieldlistfilter
     changelist = self.get_changelist(request, Book, modeladmin)
   File "django/tests/regressiontests/admin_filters/tests.py", line 140, in
 get_changelist
     modeladmin.list_select_related, modeladmin.list_per_page,
 modeladmin.list_max_show_all, modeladmin.list_editable, modeladmin)
   File "django/django/contrib/admin/views/main.py", line 70, in __init__
     self.query_set = self.get_query_set(request)
   File "django/django/contrib/admin/views/main.py", line 322, in
 get_query_set
     raise IncorrectLookupParameters(e)
 IncorrectLookupParameters: database connection isn't set to UTC

 ----------------------------------------------------------------------
 Ran 16 tests in 0.628s

 FAILED (errors=1)
 Destroying test database for alias 'default'...
 Destroying test database for alias 'other'...
 }}}

 Adding `USE_TZ = True` to the settings file makes the test pass. I suspect
 the test is failing because, despite it using
 `@override_settings(USE_TZ=True)`, the current database connection isn't
 set up to use time zones.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17882>
Django <https://code.djangoproject.com/>
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.

Reply via email to