Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19203 closed Uncategorized (fixed)

Test failing when pytz not installed and not in "America/Chicago"

Reported by: Łukasz Rekucki Owned by: Aymeric Augustin
Component: contrib.humanize Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

======================================================================
FAIL: test_naturalday_uses_localtime (django.contrib.humanize.tests.HumanizeTest
s)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "c:\Users\lrekucki\Documents\GitHub\django\django\contrib\humanize\tests.
py", line 152, in test_naturalday_uses_localtime
    self.humanize_tester([dt], ['yesterday'], 'naturalday')
  File "c:\Users\lrekucki\Documents\GitHub\django\django\contrib\humanize\tests.
py", line 40, in humanize_tester
    msg="%s test failed, produced '%s', should've produced '%s'" % (method, rend
ered, result))
AssertionError: naturalday test failed, produced 'today', should've produced 'ye
sterday'

----------------------------------------------------------------------
Ran 1 test in 1.305s

The problem is within get_default_timezone(), which returns LocalTimezone if there is no pytz installed. For me this is GMT+1 instead of asserted GMT-6, so the day stays the same. I think the test should just override the active timezone.

Change History (3)

comment:1 by Aymeric Augustin, 12 years ago

Owner: changed from nobody to Aymeric Augustin

comment:2 by Aymeric Augustin <aymeric.augustin@…>, 12 years ago

Resolution: fixed
Status: newclosed

In aff9b2f5662f8a007bb90a427190c0d573a3ba65:

Fixed #19203 -- Added isolation to a humanize test

Thanks lrekucki for the report.

comment:3 by Aymeric Augustin <aymeric.augustin@…>, 12 years ago

In 54b45dfb5384e5db24932b0d183b226c990d23ed:

[1.5.x] Fixed #19203 -- Added isolation to a humanize test

Thanks lrekucki for the report.

Backport of aff9b2f from master.

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