From f497c6e5515fe994e22b60a1ba1f9cb104919e10 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Sat, 3 Sep 2016 12:33:38 -0400 Subject: Issue 27921: Remove backslash from another f-string. I'll revert this change before beta 2. I also need to look in to why test_tools/test_unparse fails with the files that are now being skipped. --- Lib/test/test_faulthandler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/test/test_faulthandler.py') diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index fc2d6d7bae..1ff17bbcf4 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -735,11 +735,11 @@ class FaultHandlerTests(unittest.TestCase): ('EXCEPTION_INT_DIVIDE_BY_ZERO', 'int divide by zero'), ('EXCEPTION_STACK_OVERFLOW', 'stack overflow'), ): - self.check_windows_exception(f""" + self.check_windows_exception(""" import faulthandler faulthandler.enable() faulthandler._raise_exception(faulthandler._{exc}) - """, + """.format(exc=exc), 3, name) -- cgit v1.2.1 From 03c8a473999b08710ae3661724cf1bf1d76bc555 Mon Sep 17 00:00:00 2001 From: R David Murray Date: Thu, 8 Sep 2016 13:59:53 -0400 Subject: #27364: fix "incorrect" uses of escape character in the stdlib. And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter. --- Lib/test/test_faulthandler.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Lib/test/test_faulthandler.py') diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index 1ff17bbcf4..d2bd2d21e8 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -93,7 +93,7 @@ class FaultHandlerTests(unittest.TestCase): header = 'Thread 0x[0-9a-f]+' else: header = 'Stack' - regex = """ + regex = r""" ^{fatal_error} {header} \(most recent call first\): @@ -490,7 +490,7 @@ class FaultHandlerTests(unittest.TestCase): lineno = 8 else: lineno = 10 - regex = """ + regex = r""" ^Thread 0x[0-9a-f]+ \(most recent call first\): (?: File ".*threading.py", line [0-9]+ in [_a-z]+ ){{1,3}} File "", line 23 in run @@ -669,9 +669,9 @@ class FaultHandlerTests(unittest.TestCase): trace = '\n'.join(trace) if not unregister: if all_threads: - regex = 'Current thread 0x[0-9a-f]+ \(most recent call first\):\n' + regex = r'Current thread 0x[0-9a-f]+ \(most recent call first\):\n' else: - regex = 'Stack \(most recent call first\):\n' + regex = r'Stack \(most recent call first\):\n' regex = expected_traceback(14, 32, regex) self.assertRegex(trace, regex) else: -- cgit v1.2.1 From 66bb1f875a7615c255128fb1e2fd6e9e50e4cefa Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Fri, 9 Sep 2016 21:56:20 -0400 Subject: Issue 27948: Allow backslashes in the literal string portion of f-strings, but not in the expressions. Also, require expressions to begin and end with literal curly braces. --- Lib/test/test_faulthandler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/test/test_faulthandler.py') diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index d2bd2d21e8..22ccbc9062 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -735,11 +735,11 @@ class FaultHandlerTests(unittest.TestCase): ('EXCEPTION_INT_DIVIDE_BY_ZERO', 'int divide by zero'), ('EXCEPTION_STACK_OVERFLOW', 'stack overflow'), ): - self.check_windows_exception(""" + self.check_windows_exception(f""" import faulthandler faulthandler.enable() faulthandler._raise_exception(faulthandler._{exc}) - """.format(exc=exc), + """, 3, name) -- cgit v1.2.1 From 4c8b8c6298651e1036595b54a80bc2a710073876 Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Sun, 13 Nov 2016 20:46:46 +0100 Subject: Fix test_faulthandler on Android where raise() exits with 0 --- Lib/test/test_faulthandler.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Lib/test/test_faulthandler.py') diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index 22ccbc9062..bdd8d1a2a6 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -7,7 +7,7 @@ import signal import subprocess import sys from test import support -from test.support import script_helper +from test.support import script_helper, is_android, requires_android_level import tempfile import unittest from textwrap import dedent @@ -42,6 +42,10 @@ def temporary_filename(): finally: support.unlink(filename) +def requires_raise(test): + return (test if not is_android else + requires_android_level(24, 'raise() is buggy')(test)) + class FaultHandlerTests(unittest.TestCase): def get_output(self, code, filename=None, fd=None): """ @@ -141,6 +145,7 @@ class FaultHandlerTests(unittest.TestCase): 3, 'access violation') + @requires_raise def test_sigsegv(self): self.check_fatal_error(""" import faulthandler @@ -183,6 +188,7 @@ class FaultHandlerTests(unittest.TestCase): @unittest.skipIf(_testcapi is None, 'need _testcapi') @unittest.skipUnless(hasattr(signal, 'SIGBUS'), 'need signal.SIGBUS') + @requires_raise def test_sigbus(self): self.check_fatal_error(""" import _testcapi @@ -197,6 +203,7 @@ class FaultHandlerTests(unittest.TestCase): @unittest.skipIf(_testcapi is None, 'need _testcapi') @unittest.skipUnless(hasattr(signal, 'SIGILL'), 'need signal.SIGILL') + @requires_raise def test_sigill(self): self.check_fatal_error(""" import _testcapi @@ -240,6 +247,7 @@ class FaultHandlerTests(unittest.TestCase): '(?:Segmentation fault|Bus error)', other_regex='unable to raise a stack overflow') + @requires_raise def test_gil_released(self): self.check_fatal_error(""" import faulthandler @@ -249,6 +257,7 @@ class FaultHandlerTests(unittest.TestCase): 3, 'Segmentation fault') + @requires_raise def test_enable_file(self): with temporary_filename() as filename: self.check_fatal_error(""" @@ -263,6 +272,7 @@ class FaultHandlerTests(unittest.TestCase): @unittest.skipIf(sys.platform == "win32", "subprocess doesn't support pass_fds on Windows") + @requires_raise def test_enable_fd(self): with tempfile.TemporaryFile('wb+') as fp: fd = fp.fileno() @@ -276,6 +286,7 @@ class FaultHandlerTests(unittest.TestCase): 'Segmentation fault', fd=fd) + @requires_raise def test_enable_single_thread(self): self.check_fatal_error(""" import faulthandler @@ -286,6 +297,7 @@ class FaultHandlerTests(unittest.TestCase): 'Segmentation fault', all_threads=False) + @requires_raise def test_disable(self): code = """ import faulthandler -- cgit v1.2.1