Skip to content
Browse files

Fixed #19203 -- Added isolation to a humanize test

Thanks lrekucki for the report.
  • Loading branch information...
1 parent 5fec97b commit aff9b2f5662f8a007bb90a427190c0d573a3ba65 @aaugustin aaugustin committed
Showing with 11 additions and 2 deletions.
  1. +1 −1 django/conf/
  2. +10 −1 django/contrib/humanize/
2 django/conf/
@@ -34,7 +34,7 @@
# systems may support all possibilities). When USE_TZ is True, this is
# interpreted as the default user time zone.
TIME_ZONE = 'America/Chicago'
+TIME_ZONE = 'Europe/Paris'
# If you set this to True, Django will use timezone-aware datetimes.
USE_TZ = False
11 django/contrib/humanize/
@@ -1,6 +1,12 @@
from __future__ import unicode_literals
import datetime
+ import pytz
+except ImportError:
+ pytz = None
+from django.conf import settings
from django.contrib.humanize.templatetags import humanize
from django.template import Template, Context, defaultfilters
from django.test import TestCase
@@ -10,6 +16,7 @@
from django.utils import translation
from django.utils.translation import ugettext as _
from django.utils import tzinfo
+from django.utils.unittest import skipIf
# Mock out datetime in some tests so they don't fail occasionally when they
@@ -141,6 +148,8 @@ def test_naturalday_tz(self):
# As 24h of difference they will never be the same
self.assertNotEqual(naturalday_one, naturalday_two)
+ @skipIf(settings.TIME_ZONE != "Ameria/Chicago" and pytz is None,
uruz added a note

Typo: Ameria instead of America

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ "this test requires pytz when a non-default time zone is set")
def test_naturalday_uses_localtime(self):
# Regression for #18504
# This is 2012-03-08HT19:30:00-06:00 in Ameria/Chicago
@@ -148,7 +157,7 @@ def test_naturalday_uses_localtime(self):
orig_humanize_datetime, humanize.datetime = humanize.datetime, MockDateTime
- with override_settings(USE_TZ=True):
+ with override_settings(TIME_ZONE="America/Chicago", USE_TZ=True):
self.humanize_tester([dt], ['yesterday'], 'naturalday')
humanize.datetime = orig_humanize_datetime

0 comments on commit aff9b2f

Please sign in to comment.
Something went wrong with that request. Please try again.