summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_faulthandler.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-22 17:25:44 (GMT)
committerGitHub <noreply@github.com>2018-06-22 17:25:44 (GMT)
commit8fbbdf0c3107c3052659e166f73990b466eacbb0 (patch)
tree81ce7da212017b7918b2373dc68a50cb9fda52fc /Lib/test/test_faulthandler.py
parent209abf746985526bce255e2fba97d3246924885d (diff)
downloadcpython-8fbbdf0c3107c3052659e166f73990b466eacbb0.zip
cpython-8fbbdf0c3107c3052659e166f73990b466eacbb0.tar.gz
cpython-8fbbdf0c3107c3052659e166f73990b466eacbb0.tar.bz2
bpo-33671: Add support.MS_WINDOWS and support.MACOS (GH-7800)
* Add support.MS_WINDOWS: True if Python is running on Microsoft Windows. * Add support.MACOS: True if Python is running on Apple macOS. * Replace support.is_android with support.ANDROID * Replace support.is_jython with support.JYTHON * Cleanup code to initialize unix_shell
Diffstat (limited to 'Lib/test/test_faulthandler.py')
-rw-r--r--Lib/test/test_faulthandler.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index d6dc4ba..4922b00 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -6,7 +6,7 @@ import signal
import subprocess
import sys
from test import support
-from test.support import script_helper, is_android
+from test.support import script_helper
import tempfile
import threading
import unittest
@@ -18,7 +18,6 @@ except ImportError:
_testcapi = None
TIMEOUT = 0.5
-MS_WINDOWS = (os.name == 'nt')
def expected_traceback(lineno1, lineno2, header, min_count=1):
regex = header
@@ -31,7 +30,7 @@ def expected_traceback(lineno1, lineno2, header, min_count=1):
def skip_segfault_on_android(test):
# Issue #32138: Raising SIGSEGV on Android may not cause a crash.
- return unittest.skipIf(is_android,
+ return unittest.skipIf(support.ANDROID,
'raising SIGSEGV on Android is unreliable')(test)
@contextmanager
@@ -121,7 +120,7 @@ class FaultHandlerTests(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith('aix'),
"the first page of memory is a mapped read-only on AIX")
def test_read_null(self):
- if not MS_WINDOWS:
+ if not support.MS_WINDOWS:
self.check_fatal_error("""
import faulthandler
faulthandler.enable()
@@ -732,7 +731,7 @@ class FaultHandlerTests(unittest.TestCase):
with self.check_stderr_none():
faulthandler.register(signal.SIGUSR1)
- @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
+ @unittest.skipUnless(support.MS_WINDOWS, 'specific to Windows')
def test_raise_exception(self):
for exc, name in (
('EXCEPTION_ACCESS_VIOLATION', 'access violation'),
@@ -747,7 +746,7 @@ class FaultHandlerTests(unittest.TestCase):
3,
name)
- @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
+ @unittest.skipUnless(support.MS_WINDOWS, 'specific to Windows')
def test_ignore_exception(self):
for exc_code in (
0xE06D7363, # MSC exception ("Emsc")
@@ -763,7 +762,7 @@ class FaultHandlerTests(unittest.TestCase):
self.assertEqual(output, [])
self.assertEqual(exitcode, exc_code)
- @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
+ @unittest.skipUnless(support.MS_WINDOWS, 'specific to Windows')
def test_raise_nonfatal_exception(self):
# These exceptions are not strictly errors. Letting
# faulthandler display the traceback when they are
@@ -791,7 +790,7 @@ class FaultHandlerTests(unittest.TestCase):
self.assertIn(exitcode,
(exc, exc & ~0x10000000))
- @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
+ @unittest.skipUnless(support.MS_WINDOWS, 'specific to Windows')
def test_disable_windows_exc_handler(self):
code = dedent("""
import faulthandler