diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-07-22 12:48:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 12:48:41 (GMT) |
commit | 713590f9b2bef0641511b5195bdbb4c9253e9b8c (patch) | |
tree | 3f98345682f57cd44570a97662e0e167ef8d96bf /Lib/test | |
parent | 76fd98a675d0c1a4f61735f9038e1f8282b60177 (diff) | |
download | cpython-713590f9b2bef0641511b5195bdbb4c9253e9b8c.zip cpython-713590f9b2bef0641511b5195bdbb4c9253e9b8c.tar.gz cpython-713590f9b2bef0641511b5195bdbb4c9253e9b8c.tar.bz2 |
[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 4a1026d7647c084b0dc80dd49163d16ba12a2e55)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_capi/test_misc.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Lib/test/test_capi/test_misc.py b/Lib/test/test_capi/test_misc.py index 61947cb..cd37fc7 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. |