python (3.11.7)

(root)/
lib/
python3.11/
lib2to3/
tests/
test_all_fixers.py
       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 sys
      11  import test.support
      12  import unittest
      13  
      14  # Local imports
      15  from . import support
      16  
      17  
      18  @test.support.requires_resource('cpu')
      19  class ESC[4;38;5;81mTest_all(ESC[4;38;5;149msupportESC[4;38;5;149m.ESC[4;38;5;149mTestCase):
      20  
      21      def setUp(self):
      22          self.refactor = support.get_refactorer()
      23  
      24      def refactor_file(self, filepath):
      25          if test.support.verbose:
      26              print(f"Refactor file: {filepath}")
      27          if os.path.basename(filepath) == 'infinite_recursion.py':
      28              # bpo-46542: Processing infinite_recursion.py can crash Python
      29              # if Python is built in debug mode: lower the recursion limit
      30              # to prevent a crash.
      31              with test.support.infinite_recursion(150):
      32                  self.refactor.refactor_file(filepath)
      33          else:
      34              self.refactor.refactor_file(filepath)
      35  
      36      def test_all_project_files(self):
      37          for filepath in support.all_project_files():
      38              with self.subTest(filepath=filepath):
      39                  self.refactor_file(filepath)
      40  
      41  if __name__ == '__main__':
      42      unittest.main()