summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-11 01:35:22 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-01-11 01:35:22 (GMT)
commit31c5dd6b19e455fa2ab3dc1fc5497f152ce9bb7a (patch)
tree3e85ad045263042fcaa65de96670348df8a3584d /Lib
parentb7d40d170248fb2419d068c6b0647ed262e3427f (diff)
downloadcpython-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.py10
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