Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7ad24e9a
Commit
7ad24e9a
authored
Mar 31, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #11393: test_faulthandler is more tolerant on inaccurate time
parent
66046626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
Lib/test/test_faulthandler.py
Lib/test/test_faulthandler.py
+10
-7
No files found.
Lib/test/test_faulthandler.py
View file @
7ad24e9a
...
...
@@ -22,8 +22,8 @@ else:
def
expected_traceback
(
lineno1
,
lineno2
,
header
,
count
=
1
):
regex
=
header
regex
+=
r' File "\
<s
tring\
>
", line %s in func\n'
%
lineno1
regex
+=
r' File "\
<s
tring\
>
", line %s in \
<module
\
>'
%
lineno2
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
+
'$'
...
...
@@ -349,20 +349,23 @@ import time
def func(repeat, cancel, timeout):
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)
faulthandler.cancel_dump_tracebacks_later()
b = time.time()
# Check that sleep() was not interrupted
assert (b - a) >=
pause, "{{}} < {{}}".format(b - a,
pause)
assert (b - a) >=
min_pause, "{{}} < {{}}".format(b - a, min_
pause)
if cancel:
pause = timeout * 1.5
min_pause = pause * 0.9
a = time.time()
time.sleep(pause)
b = time.time()
# Check that sleep() was not interrupted
assert (b - a) >=
pause, "{{}} < {{}}".format(b - a,
pause)
assert (b - a) >=
min_pause, "{{}} < {{}}".format(b - a, min_
pause)
timeout = 0.5
repeat = {repeat}
...
...
@@ -391,8 +394,8 @@ if file is not None:
else
:
count
=
1
header
=
'Thread 0x[0-9a-f]+:
\
n
'
regex
=
expected_traceback
(
7
,
30
,
header
,
count
=
count
)
self
.
assertRegex
(
trace
,
'^%s$'
%
regex
)
regex
=
expected_traceback
(
9
,
33
,
header
,
count
=
count
)
self
.
assertRegex
(
trace
,
regex
)
self
.
assertEqual
(
exitcode
,
0
)
@
unittest
.
skipIf
(
not
hasattr
(
faulthandler
,
'dump_tracebacks_later'
),
...
...
@@ -456,7 +459,7 @@ if file is not None:
else
:
regex
=
'Traceback
\
(mos
t
recent call first
\
):
\
n'
regex
=
expected_traceback
(
6
,
14
,
regex
)
self
.
assertRegex
(
trace
,
'^%s$'
%
regex
)
self
.
assertRegex
(
trace
,
regex
)
self
.
assertEqual
(
exitcode
,
0
)
def
test_register
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment