diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2011-01-11 01:35:22 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2011-01-11 01:35:22 (GMT) |
commit | 31c5dd6b19e455fa2ab3dc1fc5497f152ce9bb7a (patch) | |
tree | 3e85ad045263042fcaa65de96670348df8a3584d /Lib | |
parent | b7d40d170248fb2419d068c6b0647ed262e3427f (diff) | |
download | cpython-31c5dd6b19e455fa2ab3dc1fc5497f152ce9bb7a.zip cpython-31c5dd6b19e455fa2ab3dc1fc5497f152ce9bb7a.tar.gz cpython-31c5dd6b19e455fa2ab3dc1fc5497f152ce9bb7a.tar.bz2 |
Make mktime test more robust.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_time.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py index d649232..574a867 100644 --- a/Lib/test/test_time.py +++ b/Lib/test/test_time.py @@ -348,9 +348,13 @@ class _Test4dYear(_BaseYearTest): except (OverflowError, ValueError): pass self.assertEqual(time.mktime(tt), t) - # Hopefully year = -1 is enough to make OS mktime fail - self.assertRaises(OverflowError, time.mktime, - (-1, 1, 1, 0, 0, 0, -1, -1, -1)) + # It may not be possible to reliably make mktime return error + # on all platfom. This will make sure that no other exception + # than OverflowError is raised for an extreme value. + try: + time.mktime((-1, 1, 1, 0, 0, 0, -1, -1, -1)) + except OverflowError: + pass class TestAsctimeAccept2dYear(_TestAsctimeYear, _Test2dYear): pass |