[3.12] gh-106714: Fix test_capi to not write a coredump (GH-107007) (#107009)

gh-106714: Fix test_capi to not write a coredump (GH-107007)

test_capi: Fix test_no_FatalError_infinite_loop() to no longer write
a coredump, by using test.support.SuppressCrashReport.
(cherry picked from commit 4a1026d764)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2023-07-22 05:48:41 -07:00 committed by GitHub
parent 76fd98a675
commit 713590f9b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -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.

View file

@ -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.