Author: Philip Jenvey <pjen...@underboss.org>
Branch: py3k
Changeset: r84800:e90d6c443b01
Date: 2016-05-28 13:57 -0700
http://bitbucket.org/pypy/pypy/changeset/e90d6c443b01/

Log:    fix platform detection

diff --git a/pypy/module/time/test/test_time.py 
b/pypy/module/time/test/test_time.py
--- a/pypy/module/time/test/test_time.py
+++ b/pypy/module/time/test/test_time.py
@@ -35,10 +35,9 @@
         assert t1 != t2       # the resolution should be at least 0.01 secs
 
     def test_clock_realtime(self):
-        import os
-        if os.name != "posix":
-            skip("clock_gettime available only under Unix")
         import time
+        if not hasattr(time, 'clock_gettime'):
+            skip("need time.clock_gettime()")
         t1 = time.clock_gettime(time.CLOCK_REALTIME)
         assert isinstance(t1, float)
         time.sleep(time.clock_getres(time.CLOCK_REALTIME))
@@ -46,10 +45,10 @@
         assert t1 != t2
 
     def test_clock_monotonic(self):
-        import os
-        if os.name != "posix":
-            skip("clock_gettime available only under Unix")
         import time
+        if not (hasattr(time, 'clock_gettime') and
+                hasattr(time, 'CLOCK_MONOTONIC')):
+            skip("need time.clock_gettime()/CLOCK_MONOTONIC")
         t1 = time.clock_gettime(time.CLOCK_MONOTONIC)
         assert isinstance(t1, float)
         time.sleep(time.clock_getres(time.CLOCK_MONOTONIC))
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to