python (3.12.0)
1 """Tests that run all fixer modules over an input stream.
2
3 This has been broken out into its own test module because of its
4 running time.
5 """
6 # Author: Collin Winter
7
8 # Python imports
9 import os.path
10 import test.support
11 import unittest
12
13 # Local imports
14 from . import support
15
16
17 @test.support.requires_resource('cpu')
18 class ESC[4;38;5;81mTest_all(ESC[4;38;5;149msupportESC[4;38;5;149m.ESC[4;38;5;149mTestCase):
19
20 def setUp(self):
21 self.refactor = support.get_refactorer()
22
23 def refactor_file(self, filepath):
24 if test.support.verbose:
25 print(f"Refactor file: {filepath}")
26 if os.path.basename(filepath) == 'infinite_recursion.py':
27 # bpo-46542: Processing infinite_recursion.py can crash Python
28 # if Python is built in debug mode: lower the recursion limit
29 # to prevent a crash.
30 with test.support.infinite_recursion(150):
31 self.refactor.refactor_file(filepath)
32 else:
33 self.refactor.refactor_file(filepath)
34
35 def test_all_project_files(self):
36 for filepath in support.all_project_files():
37 with self.subTest(filepath=filepath):
38 self.refactor_file(filepath)
39
40 if __name__ == '__main__':
41 unittest.main()