mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-106714: Fix test_capi to not write a coredump (#107007)
test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a coredump, by using test.support.SuppressCrashReport.
This commit is contained in:
parent
6dbffaed17
commit
4a1026d764
2 changed files with 12 additions and 3 deletions
|
@ -85,9 +85,15 @@ class CAPITest(unittest.TestCase):
|
|||
|
||||
@support.requires_subprocess()
|
||||
def test_no_FatalError_infinite_loop(self):
|
||||
run_result, _cmd_line = run_python_until_end(
|
||||
'-c', 'import _testcapi; _testcapi.crash_no_current_thread()',
|
||||
)
|
||||
code = textwrap.dedent("""
|
||||
import _testcapi
|
||||
from test import support
|
||||
|
||||
with support.SuppressCrashReport():
|
||||
_testcapi.crash_no_current_thread()
|
||||
""")
|
||||
|
||||
run_result, _cmd_line = run_python_until_end('-c', code)
|
||||
_rc, out, err = run_result
|
||||
self.assertEqual(out, b'')
|
||||
# This used to cause an infinite loop.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
test_capi: Fix test_no_FatalError_infinite_loop() to no longer write a
|
||||
coredump, by using test.support.SuppressCrashReport. Patch by Victor
|
||||
Stinner.
|
Loading…
Add table
Add a link
Reference in a new issue