summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_faulthandler.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-01 11:49:12 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-01 11:49:12 (GMT)
commit301f3f093c463b8eba8f55d6cb3eecc0893d5cfa (patch)
treee05a58e3859bbb68bee0e854c572d466a508e5cb /Lib/test/test_faulthandler.py
parentebbbdafd8782b02eaf05f5c99ed000dbd6ad0ae1 (diff)
downloadcpython-301f3f093c463b8eba8f55d6cb3eecc0893d5cfa.zip
cpython-301f3f093c463b8eba8f55d6cb3eecc0893d5cfa.tar.gz
cpython-301f3f093c463b8eba8f55d6cb3eecc0893d5cfa.tar.bz2
test_faulthandler: use a longer sleep (2.5 sec instead of 1.3 sec) in
_check_dump_tracebacks_later() to avoid failures if the system is slow.
Diffstat (limited to 'Lib/test/test_faulthandler.py')
-rw-r--r--Lib/test/test_faulthandler.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index dbc1917..0ddfc7f 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -29,13 +29,14 @@ else:
except (ValueError, resource_error):
pass
-def expected_traceback(lineno1, lineno2, header, count=1):
+def expected_traceback(lineno1, lineno2, header, min_count=1):
regex = header
regex += ' File "<string>", line %s in func\n' % lineno1
regex += ' File "<string>", line %s in <module>' % lineno2
- if count != 1:
- regex = (regex + '\n') * (count - 1) + regex
- return '^' + regex + '$'
+ if 1 < min_count:
+ return '^' + (regex + '\n') * (min_count - 1) + regex
+ else:
+ return '^' + regex + '$'
@contextmanager
def temporary_filename():
@@ -371,7 +372,7 @@ def func(timeout, repeat, cancel, file, loops):
faulthandler.dump_tracebacks_later(timeout, repeat=repeat, file=file)
if cancel:
faulthandler.cancel_dump_tracebacks_later()
- time.sleep(timeout * 2.5)
+ time.sleep(timeout * 5)
faulthandler.cancel_dump_tracebacks_later()
timeout = {timeout}
@@ -402,7 +403,7 @@ if file is not None:
if repeat:
count *= 2
header = r'Timeout \(%s\)!\nThread 0x[0-9a-f]+:\n' % timeout_str
- regex = expected_traceback(9, 20, header, count=count)
+ regex = expected_traceback(9, 20, header, min_count=count)
self.assertRegex(trace, regex)
else:
self.assertEqual(trace, '')