Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Hardened the test introduced in ded11aa. Refs #18766.

Inputs acceptable to time.mktime are platform-dependent.
  • Loading branch information...
1 parent 96fd555 commit 1a1e14786aa35b4d80b46be747b5128800cf0f97 @aaugustin aaugustin committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 tests/utils_tests/
6 tests/utils_tests/
@@ -24,8 +24,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):

0 comments on commit 1a1e147

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