diff --git a/pylint/testutils/functional/find_functional_tests.py b/pylint/testutils/functional/find_functional_tests.py index 392a8f33fb..ea58c22138 100644 --- a/pylint/testutils/functional/find_functional_tests.py +++ b/pylint/testutils/functional/find_functional_tests.py @@ -10,10 +10,13 @@ from pylint.testutils.functional.test_file import FunctionalTestFile -REASONABLY_DISPLAYABLE_VERTICALLY = 49 -"""'Wet finger' number of files that are reasonable to display by an IDE. +REASONABLY_DISPLAYABLE_VERTICALLY = 40 +"""'Wet finger' number of python files that are reasonable to have in a functional test +directory. 'Wet finger' as in 'in my settings there are precisely this many'. +Initially the total number of files then we started counting only the python files to +avoid moving a lot of files. """ IGNORED_PARENT_DIRS = { @@ -21,7 +24,6 @@ "ext", "regression", "regression_02", - "used_02", } """Direct parent directories that should be ignored.""" @@ -71,7 +73,9 @@ def _get_files_from_dir( ) -> list[Path]: """Return directories and files from a directory and handles violations.""" files_without_leading_underscore = list( - p for p in path.iterdir() if not p.stem.startswith("_") + p + for p in path.iterdir() + if not (p.stem.startswith("_") or (p.is_file() and p.suffix != ".py")) ) if len(files_without_leading_underscore) > max_file_per_directory: violations.append((path, len(files_without_leading_underscore))) @@ -86,7 +90,6 @@ def walk(path: Path) -> Iterator[Path]: ) for _file_or_dir in parent_dir_files: if _file_or_dir.is_dir(): - _files = _get_files_from_dir(_file_or_dir, violations) yield _file_or_dir.resolve() try: yield from walk(_file_or_dir) diff --git a/tests/functional/u/used_02/used_before_assignment_py313.py b/tests/functional/u/used/used_before_assignment_py313.py similarity index 100% rename from tests/functional/u/used_02/used_before_assignment_py313.py rename to tests/functional/u/used/used_before_assignment_py313.py diff --git a/tests/functional/u/used_02/used_before_assignment_py313.rc b/tests/functional/u/used/used_before_assignment_py313.rc similarity index 100% rename from tests/functional/u/used_02/used_before_assignment_py313.rc rename to tests/functional/u/used/used_before_assignment_py313.rc diff --git a/tests/functional/u/used_02/used_before_assignment_py313.txt b/tests/functional/u/used/used_before_assignment_py313.txt similarity index 100% rename from tests/functional/u/used_02/used_before_assignment_py313.txt rename to tests/functional/u/used/used_before_assignment_py313.txt diff --git a/tests/testutils/data/m/max_overflow/max_overflow_3.py b/tests/testutils/data/m/max_overflow/max_overflow_3.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/testutils/test_functional_testutils.py b/tests/testutils/test_functional_testutils.py index 0d332f02d9..2b1574e354 100644 --- a/tests/testutils/test_functional_testutils.py +++ b/tests/testutils/test_functional_testutils.py @@ -85,13 +85,14 @@ def test_get_functional_test_files_from_crowded_directory() -> None: get_functional_test_files_from_directory( DATA_DIRECTORY / "m", max_file_per_directory=1 ) - assert exc_info.match("m: 4 when the max is 1") - assert exc_info.match("max_overflow: 3 when the max is 1") + assert exc_info.match("m: 3 when the max is 1") + assert exc_info.match("max_overflow: 2 when the max is 1") + assert len(exc_info.value.args[0].splitlines()) == 3 with pytest.raises(AssertionError) as exc_info: get_functional_test_files_from_directory( - DATA_DIRECTORY / "m", max_file_per_directory=3 + DATA_DIRECTORY / "m", max_file_per_directory=2 ) - assert exc_info.match("m: 4 when the max is 3") + assert exc_info.match("m: 3 when the max is 2") assert "max_overflow" not in str(exc_info.value)