Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25562 closed Bug (fixed)

Time dependent test on Windows: admin_filters.tests.ListFiltersTests.test_datefieldlistfilter_with_time_zone_support

Reported by: Tim Graham Owned by: nobody
Component: contrib.admin Version: 1.8
Severity: Normal Keywords:
Cc: Brian Gianforcaro, Aymeric Augustin Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This test doesn't pass at all hours of the day on Windows:

Traceback (most recent call last):
  File "C:\Jenkins\workspace\django-windows\database\sqlite3\label\windows\python\Python27\django\test\utils.py", line 181, in inner
    return test_func(*args, **kwargs)
  File "C:\Jenkins\workspace\django-windows\database\sqlite3\label\windows\python\Python27\tests\admin_filters\tests.py", line 387, in test_datefieldlistfilter_with_time_zone_support
    self.test_datefieldlistfilter()
  File "C:\Jenkins\workspace\django-windows\database\sqlite3\label\windows\python\Python27\tests\admin_filters\tests.py", line 302, in test_datefieldlistfilter
    self.assertEqual(choice['selected'], True)
AssertionError: False != True

Change History (6)

comment:1 by Tim Graham, 9 years ago

Cc: Brian Gianforcaro Aymeric Augustin added

The issue here seems to related to ticket #2315 and the lack of time.tzset() on Windows. This causes datetime.date.today to return a different value on Windows (ignoring the time zone) than on Unix because the time zone that Django sets is never activated on Windows.

Absent another solution, we can skip the test on Windows, but I'm not sure what this means for timezone support on Windows in general. A note in the timezone docs might be useful.

comment:2 by Aymeric Augustin, 9 years ago

IIRC time zone supports on Windows requires TIME_ZONE to match the system time zone.

See https://docs.djangoproject.com/en/1.8/ref/settings/#std:setting-TIME_ZONE

As a consequence you can't run a test that requires changing the TIME_ZONE setting (unless you also change the system time zone but that sounds overkill).

comment:3 by Simon Charette, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 4a50daf:

Fixed #25562 -- Skipped a time dependent admin_filters test on Windows.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In cf1038d8:

[1.8.x] Fixed #25562 -- Skipped a time dependent admin_filters test on Windows.

Backport of 4a50daf6b343db1b5c316aa29efd657e160d0cd3 from master

comment:6 by Tim Graham <timograham@…>, 9 years ago

In 994e766:

[1.9.x] Fixed #25562 -- Skipped a time dependent admin_filters test on Windows.

Backport of 4a50daf6b343db1b5c316aa29efd657e160d0cd3 from master

Note: See TracTickets for help on using tickets.
Back to Top