Skip to content
Prev Previous commit
Next Next commit
Fixup faulthandler test.
  • Loading branch information
markshannon committed Mar 23, 2023
commit 8e555ca460d5c21f46c0801bb09b072a3561e590
17 changes: 12 additions & 5 deletions Lib/test/test_faulthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def check_error(self, code, lineno, fatal_error, *,
# Enable MULTILINE flag
regex = f'(?m){regex}'
output, exitcode = self.get_output(code, filename=filename, fd=fd)
output = '\n'.join(output)
output = '\n'.join([line for line in output if
"Builtin function" not in line and
"Method descriptor" not in line])
self.assertRegex(output, regex)
self.assertNotEqual(exitcode, 0)

Expand Down Expand Up @@ -484,6 +486,7 @@ def funcA():
lineno = 14
expected = [
'Stack (most recent call first):',
' Builtin function dump_traceback',
' File "<string>", line %s in funcB' % lineno,
' File "<string>", line 17 in funcA',
' File "<string>", line 19 in <module>'
Expand Down Expand Up @@ -529,6 +532,7 @@ def {func_name}():
)
expected = [
'Stack (most recent call first):',
' Builtin function dump_traceback',
' File "<string>", line 4 in %s' % truncated,
' File "<string>", line 6 in <module>'
]
Expand Down Expand Up @@ -575,7 +579,9 @@ def run(self):
"""
code = code.format(filename=repr(filename))
output, exitcode = self.get_output(code, filename)
output = '\n'.join(output)
output = '\n'.join([line for line in output if
"Builtin function" not in line and
"Method descriptor" not in line])
if filename:
lineno = 8
else:
Expand Down Expand Up @@ -651,8 +657,9 @@ def func(timeout, repeat, cancel, file, loops):
fd=fd,
)
trace, exitcode = self.get_output(code, filename)
trace = '\n'.join(trace)

trace = '\n'.join([line for line in trace if
"Builtin function" not in line and
"Method descriptor" not in line])
if not cancel:
count = loops
if repeat:
Expand Down Expand Up @@ -754,7 +761,7 @@ def handler(signum, frame):
fd=fd,
)
trace, exitcode = self.get_output(code, filename)
trace = '\n'.join(trace)
trace = '\n'.join([line for line in trace if "Builtin function" not in line ])
if not unregister:
if all_threads:
regex = r'Current thread 0x[0-9a-f]+ \(most recent call first\):\n'
Expand Down