#21756 closed Bug (fixed)

utils_tests.test_dateformat.DateFormatTests failing on Windows with pytz installed

Reported by: manfre Owned by: aaugustin
Component: Utilities Version: master
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:1 Changed 16 months ago by manfre

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 16 months ago by manfre

  • Component changed from Testing framework to Utilities
  • Keywords timezone tzinfo added
  • Severity changed from Normal to Release blocker
  • Triage Stage changed from Unreviewed to Accepted

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

comment:3 Changed 16 months ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned

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 Changed 16 months ago by aaugustin

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

comment:5 Changed 16 months ago by Aymeric Augustin <aymeric.augustin@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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