summaryrefslogtreecommitdiff
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2013-12-08 00:44:27 -0600
committerZachary Ware <zachary.ware@gmail.com>2013-12-08 00:44:27 -0600
commit498289b4fc9f76d201782a4955ebfd6d6cc2faf2 (patch)
tree4648d6f83d7ac8f0b2d21d347c9d5fea6d2f60a7 /Lib/test/test_time.py
parent4661ee73929e25fbaa6a5ac4aff490ff783616a9 (diff)
parent1cd17e53a3ef332cc052a7c66ddc8e76da7de591 (diff)
downloadcpython-498289b4fc9f76d201782a4955ebfd6d6cc2faf2.tar.gz
Issue 19572: More silently skipped tests explicitly skipped.
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 2997077bcb..048cb3b6d7 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -371,6 +371,14 @@ class TimeTestCase(unittest.TestCase):
@unittest.skipUnless(hasattr(time, 'monotonic'),
'need time.monotonic')
def test_monotonic(self):
+ # monotonic() should not go backward
+ times = [time.monotonic() for n in range(100)]
+ t1 = times[0]
+ for t2 in times[1:]:
+ self.assertGreaterEqual(t2, t1, "times=%s" % times)
+ t1 = t2
+
+ # monotonic() includes time elapsed during a sleep
t1 = time.monotonic()
time.sleep(0.5)
t2 = time.monotonic()
@@ -378,6 +386,7 @@ class TimeTestCase(unittest.TestCase):
self.assertGreater(t2, t1)
self.assertAlmostEqual(dt, 0.5, delta=0.2)
+ # monotonic() is a monotonic but non adjustable clock
info = time.get_clock_info('monotonic')
self.assertTrue(info.monotonic)
self.assertFalse(info.adjustable)