diff options
author | Victor Stinner <vstinner@python.org> | 2021-01-18 17:24:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-18 17:24:29 (GMT) |
commit | e232025025c8bd07c1d1b12a583a80c4a673f077 (patch) | |
tree | 4e933d341363bcefedf7ca25f51cd35549ac86d0 /Lib/test/test_capi.py | |
parent | 998ae1fa3fb05a790071217cf8f6ae3a928da13f (diff) | |
download | cpython-e232025025c8bd07c1d1b12a583a80c4a673f077.zip cpython-e232025025c8bd07c1d1b12a583a80c4a673f077.tar.gz cpython-e232025025c8bd07c1d1b12a583a80c4a673f077.tar.bz2 |
bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)
Move faulthandler._fatal_error() to _testcapi.fatal_error().
Diffstat (limited to 'Lib/test/test_capi.py')
-rw-r--r-- | Lib/test/test_capi.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index a4ebe4a..0d5c97dcc 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -547,6 +547,15 @@ class CAPITest(unittest.TestCase): self.assertRaises(TypeError, pynumber_tobase, '123', 10) self.assertRaises(SystemError, pynumber_tobase, 123, 0) + def test_fatal_error(self): + code = 'import _testcapi; _testcapi.fatal_error(b"MESSAGE")' + with support.SuppressCrashReport(): + rc, out, err = assert_python_failure('-sSI', '-c', code) + + err = err.replace(b'\r', b'').decode('ascii', 'replace') + self.assertIn('Fatal Python error: test_fatal_error: MESSAGE\n', + err) + class TestPendingCalls(unittest.TestCase): |