Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.6.x] Hardened the test introduced in ded11aa. Refs #18766.

Inputs acceptable to time.mktime are platform-dependent.

Backport of 1a1e147 from master.
  • Loading branch information...
commit 0035a0ce2ec243ff9255157117c20caf41a61284 1 parent 7c31e19
@aaugustin aaugustin authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 tests/utils_tests/test_timezone.py
View
6 tests/utils_tests/test_timezone.py
@@ -23,8 +23,12 @@ def test_localtime(self):
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):
Please sign in to comment.
Something went wrong with that request. Please try again.