diff options
Diffstat (limited to 'Lib/lib2to3/tests/test_all_fixers.py')
-rw-r--r-- | Lib/lib2to3/tests/test_all_fixers.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/lib2to3/tests/test_all_fixers.py b/Lib/lib2to3/tests/test_all_fixers.py index c0507cf..a265941 100644 --- a/Lib/lib2to3/tests/test_all_fixers.py +++ b/Lib/lib2to3/tests/test_all_fixers.py @@ -6,8 +6,10 @@ running time. # Author: Collin Winter # Python imports -import unittest +import os.path +import sys import test.support +import unittest # Local imports from . import support @@ -19,9 +21,22 @@ class Test_all(support.TestCase): def setUp(self): self.refactor = support.get_refactorer() + def refactor_file(self, filepath): + if test.support.verbose: + print(f"Refactor file: {filepath}") + if os.path.basename(filepath) == 'infinite_recursion.py': + # bpo-46542: Processing infinite_recursion.py can crash Python + # if Python is built in debug mode: lower the recursion limit + # to prevent a crash. + with test.support.infinite_recursion(150): + self.refactor.refactor_file(filepath) + else: + self.refactor.refactor_file(filepath) + def test_all_project_files(self): for filepath in support.all_project_files(): - self.refactor.refactor_file(filepath) + with self.subTest(filepath=filepath): + self.refactor_file(filepath) if __name__ == '__main__': unittest.main() |