[pypy-commit] pypy kill-someobject: Fix this test too

arigo noreply at buildbot.pypy.org
Wed Oct 10 13:01:01 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: kill-someobject
Changeset: r57969:5efa41fbc8c6
Date: 2012-10-10 13:00 +0200
http://bitbucket.org/pypy/pypy/changeset/5efa41fbc8c6/

Log:	Fix this test too

diff --git a/pypy/translator/c/test/test_extfunc.py b/pypy/translator/c/test/test_extfunc.py
--- a/pypy/translator/c/test/test_extfunc.py
+++ b/pypy/translator/c/test/test_extfunc.py
@@ -8,25 +8,15 @@
 from pypy.translator.c.test.test_standalone import StandaloneTests
 posix = __import__(os.name)
 
-# note: clock synchronizes itself!
 def test_time_clock():
     def does_stuff():
-        return time.clock()
+        t1 = t2 = time.clock()
+        while abs(t2 - t1) < 0.01:
+            t2 = time.clock()
+        return t2 - t1
     f1 = compile(does_stuff, [])
-    t0 = time.clock()
-    t1 = f1()
-    t2 = time.clock()
-    t3 = f1()
-    t4 = time.clock()
-    t5 = f1()
-    t6 = time.clock()
-    # time.clock() and t1() might have a different notion of zero, so
-    # we can only subtract two numbers returned by the same function.
-    assert 0 <= t2-t0
-    assert 0 <= t3-t1 <= t4-t0
-    assert 0 <= t4-t2 <= t5-t1 <= t6-t0
-    assert 0 <= t5-t3 <= t6-t2
-    assert 0 <= t6-t4
+    t = f1()
+    assert 0 < t < 1.5
 
 def test_time_sleep():
     def does_nothing():


More information about the pypy-commit mailing list