summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-09-08 19:38:12 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-09-08 19:41:34 +0200
commit0035a0ce2ec243ff9255157117c20caf41a61284 (patch)
treea75e9e9ac34bd34ab34ad4c1d41b7e530f57b5c8 /tests/utils_tests
parent7c31e195db963ad1ebb28265e721097000fa84d1 (diff)
[1.6.x] Hardened the test introduced in ded11aa6. Refs #18766.
Inputs acceptable to time.mktime are platform-dependent. Backport of 1a1e1478 from master.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_timezone.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/utils_tests/test_timezone.py b/tests/utils_tests/test_timezone.py
index 86e3a66008..2d14c85234 100644
--- a/tests/utils_tests/test_timezone.py
+++ b/tests/utils_tests/test_timezone.py
@@ -23,8 +23,12 @@ class TimezoneTests(unittest.TestCase):
def test_localtime_out_of_range(self):
local_tz = timezone.LocalTimezone()
long_ago = datetime.datetime(1900, 1, 1, tzinfo=timezone.utc)
- with six.assertRaisesRegex(self, OverflowError, "install pytz"):
+ try:
timezone.localtime(long_ago, local_tz)
+ except OverflowError as exc:
+ self.assertIn("install pytz", exc.args[0])
+ else:
+ raise unittest.SkipTest("Failed to trigger an OverflowError")
def test_now(self):
with override_settings(USE_TZ=True):