[Python-checkins] cpython: Issue #11765: don't test time.sleep() in test_faulthandler

victor.stinner python-checkins at python.org
Mon Apr 4 23:42:34 CEST 2011


http://hg.python.org/cpython/rev/8da8cd1ba9d9
changeset:   69146:8da8cd1ba9d9
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon Apr 04 23:42:30 2011 +0200
summary:
  Issue #11765: don't test time.sleep() in test_faulthandler

time.time() and/or time.sleep() are not accurate on Windows, don't test them
in test_faulthandler. Anyway, the check was written for an old implementation
of dump_tracebacks_later(), it is not more needed.

files:
  Lib/test/test_faulthandler.py |  12 ++----------
  1 files changed, 2 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -360,16 +360,8 @@
 def func(repeat, cancel, timeout):
     if cancel:
         faulthandler.cancel_dump_tracebacks_later()
-
-    pause = timeout * 2.5
-    # on Windows XP, b-a gives 1.249931 after sleep(1.25)
-    min_pause = pause * 0.9
-    a = time.time()
-    time.sleep(pause)
-    b = time.time()
+    time.sleep(timeout * 2.5)
     faulthandler.cancel_dump_tracebacks_later()
-    # Check that sleep() was not interrupted
-    assert (b - a) >= min_pause, "{{}} < {{}}".format(b - a, min_pause)
 
 timeout = {timeout}
 repeat = {repeat}
@@ -400,7 +392,7 @@
             else:
                 count = 1
             header = 'Thread 0x[0-9a-f]+:\n'
-            regex = expected_traceback(12, 27, header, count=count)
+            regex = expected_traceback(7, 19, header, count=count)
             self.assertRegex(trace, regex)
         else:
             self.assertEqual(trace, '')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list