Opened 11 years ago

Closed 11 years ago

#21756 closed Bug (fixed)

utils_tests.test_dateformat.DateFormatTests failing on Windows with pytz installed

Reported by: Michael Manfre Owned by: Aymeric Augustin
Component: Utilities Version: dev
Severity: Release blocker Keywords: timezone tzinfo
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Running python runtests.py --noinput --settings=test_sqlite utils_tests.test_dateformat

With pytz installed:

======================================================================
FAIL: test_datetime_with_local_tzinfo (utils_tests.test_dateformat.DateFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\project\django\django\tests\utils_tests\test_dateformat.py", line 38, in test_datetime_with_local_tzinfo
    self.assertEqual(datetime.fromtimestamp(int(format(dt, 'U'))), dt.replace(tzinfo=None))
AssertionError: datetime.datetime(2009, 5, 15, 23, 30, 30) != datetime.datetime(2009, 5, 16, 5, 30, 30)

======================================================================
FAIL: test_datetime_with_tzinfo (utils_tests.test_dateformat.DateFormatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\project\django\django\tests\utils_tests\test_dateformat.py", line 47, in test_datetime_with_tzinfo
    self.assertEqual(datetime.fromtimestamp(int(format(dt, 'U'))), dt.astimezone(ltz).replace(tzinfo=None))
AssertionError: datetime.datetime(2009, 5, 15, 23, 30, 30) != datetime.datetime(2009, 5, 16, 5, 30, 30)

----------------------------------------------------------------------
Ran 13 tests in 0.134s

FAILED (failures=2)

With pytz uninstalled:

Creating test database for alias 'default'...
Creating test database for alias 'other'...
.............
----------------------------------------------------------------------
Ran 13 tests in 0.013s

OK

Change History (5)

comment:2 by Michael Manfre, 11 years ago

Component: Testing frameworkUtilities
Keywords: timezone tzinfo added
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Marking my own ticket as accepted and a release blocker because it's a bisected regression.

comment:3 by Aymeric Augustin, 11 years ago

Owner: changed from nobody to Aymeric Augustin
Status: newassigned

It's probably just a matter of skipping these tests, Windows can't use a time zone other than the system time zone.

comment:4 by Aymeric Augustin, 11 years ago

Affected tests use 'Europe/Copenhagen', which is the same as 'Europe/Paris'; that's why I didn't notice the issue.

comment:5 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 9cc3371a0f45894de12d2fb60a57afd111fb9c3e:

Fixed #21756 -- Skipped two timezone-related tests on Windows.

Windows cannot use a time zone other than the default time zone.

Thanks manfre for the report.

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