Code

Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#19203 closed Uncategorized (fixed)

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

Reported by: lrekucki Owned by: aaugustin
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.

Attachments (0)

Change History (3)

comment:1 Changed 18 months ago by aaugustin

  • Owner changed from nobody to aaugustin

comment:2 Changed 18 months ago by Aymeric Augustin <aymeric.augustin@…>

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

In aff9b2f5662f8a007bb90a427190c0d573a3ba65:

Fixed #19203 -- Added isolation to a humanize test

Thanks lrekucki for the report.

comment:3 Changed 18 months ago by Aymeric Augustin <aymeric.augustin@…>

In 54b45dfb5384e5db24932b0d183b226c990d23ed:

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

Thanks lrekucki for the report.

Backport of aff9b2f from master.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.