diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-09-18 12:15:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-18 12:15:10 (GMT) |
commit | 0a963fbc9c4cf4569f1eadaa2aa1229bb0081256 (patch) | |
tree | 8c56b4aaead5f269c769f16b7ff49e5320900b88 /Lib/test | |
parent | da57599af51c602b015b6880123fef6eccdabcf5 (diff) | |
download | cpython-0a963fbc9c4cf4569f1eadaa2aa1229bb0081256.zip cpython-0a963fbc9c4cf4569f1eadaa2aa1229bb0081256.tar.gz cpython-0a963fbc9c4cf4569f1eadaa2aa1229bb0081256.tar.bz2 |
bpo-38203: faulthandler.dump_traceback_later() is always available (GH-16249)
dump_traceback_later() and cancel_dump_traceback_later() functions of
the faulthandler module are always available since Python 3.7.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/eintrdata/eintr_tester.py | 8 | ||||
-rw-r--r-- | Lib/test/libregrtest/main.py | 5 | ||||
-rw-r--r-- | Lib/test/test_faulthandler.py | 7 | ||||
-rw-r--r-- | Lib/test/test_regrtest.py | 5 |
4 files changed, 6 insertions, 19 deletions
diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py index 404934c..4e0e305 100644 --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -57,9 +57,8 @@ class EINTRBaseTest(unittest.TestCase): # Use faulthandler as watchdog to debug when a test hangs # (timeout of 10 minutes) - if hasattr(faulthandler, 'dump_traceback_later'): - faulthandler.dump_traceback_later(10 * 60, exit=True, - file=sys.__stderr__) + faulthandler.dump_traceback_later(10 * 60, exit=True, + file=sys.__stderr__) @staticmethod def stop_alarm(): @@ -68,8 +67,7 @@ class EINTRBaseTest(unittest.TestCase): def tearDown(self): self.stop_alarm() signal.signal(signal.SIGALRM, self.orig_handler) - if hasattr(faulthandler, 'cancel_dump_traceback_later'): - faulthandler.cancel_dump_traceback_later() + faulthandler.cancel_dump_traceback_later() def subprocess(self, *args, **kw): cmd_args = (sys.executable, '-c') + args diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index 47c6012..2997006 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -164,11 +164,6 @@ class Regrtest: def parse_args(self, kwargs): ns = _parse_args(sys.argv[1:], **kwargs) - if ns.timeout and not hasattr(faulthandler, 'dump_traceback_later'): - print("Warning: The timeout option requires " - "faulthandler.dump_traceback_later", file=sys.stderr) - ns.timeout = None - if ns.xmlpath: support.junit_xml_list = self.testsuite_xml = [] diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index 2448744..a4427a5 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -535,8 +535,6 @@ class FaultHandlerTests(unittest.TestCase): with temporary_filename() as filename: self.check_dump_traceback_threads(filename) - @unittest.skipIf(not hasattr(faulthandler, 'dump_traceback_later'), - 'need faulthandler.dump_traceback_later()') def check_dump_traceback_later(self, repeat=False, cancel=False, loops=1, *, filename=None, fd=None): """ @@ -744,9 +742,8 @@ class FaultHandlerTests(unittest.TestCase): faulthandler.enable() with self.check_stderr_none(): faulthandler.dump_traceback() - if hasattr(faulthandler, 'dump_traceback_later'): - with self.check_stderr_none(): - faulthandler.dump_traceback_later(1e-3) + with self.check_stderr_none(): + faulthandler.dump_traceback_later(1e-3) if hasattr(faulthandler, "register"): with self.check_stderr_none(): faulthandler.register(signal.SIGUSR1) diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index ef2ee90..5091199 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -54,8 +54,6 @@ class ParseArgsTestCase(unittest.TestCase): libregrtest._parse_args([opt]) self.assertIn('Run Python regression tests.', out.getvalue()) - @unittest.skipUnless(hasattr(faulthandler, 'dump_traceback_later'), - "faulthandler.dump_traceback_later() required") def test_timeout(self): ns = libregrtest._parse_args(['--timeout', '4.2']) self.assertEqual(ns.timeout, 4.2) @@ -572,8 +570,7 @@ class ProgramsTestCase(BaseTestCase): self.python_args = ['-Wd', '-E', '-bb'] self.regrtest_args = ['-uall', '-rwW', '--testdir=%s' % self.tmptestdir] - if hasattr(faulthandler, 'dump_traceback_later'): - self.regrtest_args.extend(('--timeout', '3600', '-j4')) + self.regrtest_args.extend(('--timeout', '3600', '-j4')) if sys.platform == 'win32': self.regrtest_args.append('-n') |