summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-07-02 08:34:13 (GMT)
committerGitHub <noreply@github.com>2024-07-02 08:34:13 (GMT)
commit7435f053b4a54372a2c43dee7a15c4b973f09209 (patch)
treec6cbc234f02555bfb676c2e9e8e16c0e7d3a4c64 /Lib/test/test_support.py
parentbfe0e4d7696647a546110328510bdb98146ad2f2 (diff)
downloadcpython-7435f053b4a54372a2c43dee7a15c4b973f09209.zip
cpython-7435f053b4a54372a2c43dee7a15c4b973f09209.tar.gz
cpython-7435f053b4a54372a2c43dee7a15c4b973f09209.tar.bz2
Move get_signal_name() to test.support (#121251)
* Move get_signal_name() from test.libregrtest to test.support. * Use get_signal_name() in support.script_helper. * support.script_helper now decodes stdout and stderr from UTF-8, instead of ASCII, if a command failed.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index d6f024a..e60e547 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -3,6 +3,7 @@ import importlib
import io
import os
import shutil
+import signal
import socket
import stat
import subprocess
@@ -732,6 +733,17 @@ class TestSupport(unittest.TestCase):
self.assertEqual(support.copy_python_src_ignore(path, os.listdir(path)),
ignored)
+ def test_get_signal_name(self):
+ for exitcode, expected in (
+ (-int(signal.SIGINT), 'SIGINT'),
+ (-int(signal.SIGSEGV), 'SIGSEGV'),
+ (128 + int(signal.SIGABRT), 'SIGABRT'),
+ (3221225477, "STATUS_ACCESS_VIOLATION"),
+ (0xC00000FD, "STATUS_STACK_OVERFLOW"),
+ ):
+ self.assertEqual(support.get_signal_name(exitcode), expected,
+ exitcode)
+
# XXX -follows a list of untested API
# make_legacy_pyc
# is_resource_enabled