diff options
author | Victor Stinner <vstinner@python.org> | 2023-07-22 12:17:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 12:17:25 (GMT) |
commit | 4a1026d7647c084b0dc80dd49163d16ba12a2e55 (patch) | |
tree | dd70a101bf6ff5fc7c6446ab282dbb7e8e1b34f4 | |
parent | 6dbffaed17d59079d6a2788d686009f762a3278f (diff) | |
download | cpython-4a1026d7647c084b0dc80dd49163d16ba12a2e55.zip cpython-4a1026d7647c084b0dc80dd49163d16ba12a2e55.tar.gz cpython-4a1026d7647c084b0dc80dd49163d16ba12a2e55.tar.bz2 |
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.
-rw-r--r-- | Lib/test/test_capi/test_misc.py | 12 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2023-07-22-13-49-40.gh-issue-106714.btYI5S.rst | 3 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index e40ffdf..dc155cc 100644 --- a/Lib/test/test_capi/test_misc.py +++ b/Lib/test/test_capi/test_misc.py @@ -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. diff --git a/Misc/NEWS.d/next/Tests/2023-07-22-13-49-40.gh-issue-106714.btYI5S.rst b/Misc/NEWS.d/next/Tests/2023-07-22-13-49-40.gh-issue-106714.btYI5S.rst new file mode 100644 index 0000000..9556205 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-07-22-13-49-40.gh-issue-106714.btYI5S.rst @@ -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. |