summaryrefslogtreecommitdiff
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-20 02:24:18 +0100
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-20 02:24:18 +0100
commit9c348c77866e7ad36354544a3e9a19deacc90f4c (patch)
tree974d079c634e864ccd59c3f9f1bf91a37db5f35a /Lib/test/test_time.py
parenta492ac5b62a9caa2282f4db44ebb767d1f1cfd0e (diff)
downloadcpython-9c348c77866e7ad36354544a3e9a19deacc90f4c.tar.gz
Issue #10278: Be more explicit in tests than wallclock() is monotonic (cannot
go backward)
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 1597ac1ace..d34b870f73 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -332,11 +332,16 @@ class TimeTestCase(unittest.TestCase):
self.assertEqual(time.strftime('%Z', tt), tzname)
def test_wallclock(self):
- t0 = time.wallclock()
- time.sleep(0.1)
t1 = time.wallclock()
- t = t1 - t0
- self.assertAlmostEqual(t, 0.1, delta=0.2)
+ t2 = time.wallclock()
+ self.assertGreater(t2, t1)
+
+ t1 = time.wallclock()
+ time.sleep(0.1)
+ t2 = time.wallclock()
+ self.assertGreater(t2, t1)
+ dt = t2 - t1
+ self.assertAlmostEqual(dt, 0.1, delta=0.2)
class TestLocale(unittest.TestCase):