| 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 |
|
| 7 |
|
| 8 |
|
| 9 |
import os.path |
| 10 |
import sys |
| 11 |
import test.support |
| 12 |
import unittest |
| 13 |
|
| 14 |
|
| 15 |
from . import support |
| 16 |
|
| 17 |
|
| 18 |
@test.support.requires_resource('cpu') |
| 19 |
class Test_all(support.TestCase): |
| 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 |
|
| 29 |
|
| 30 |
|
| 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() |