bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)

Move faulthandler._fatal_error() to _testcapi.fatal_error().
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index a4ebe4a..0d5c97d 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -547,6 +547,15 @@ def test_pynumber_tobase(self):
         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):