diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-23 14:24:33 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-28 21:48:17 +0200 |
commit | 1343dd3f84e62873a40c6fa5bc8b8ba8a6f06d06 (patch) | |
tree | 737a51f89dbabe3a2852a1a9d6a1d9c01d118176 /pylint/testutils | |
parent | 731746365b28a406faaa3aff406eb81c92faefc9 (diff) | |
download | pylint-git-1343dd3f84e62873a40c6fa5bc8b8ba8a6f06d06.tar.gz |
[testutil] Display all the crowded functional test dir at once
Diffstat (limited to 'pylint/testutils')
-rw-r--r-- | pylint/testutils/functional/find_functional_tests.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pylint/testutils/functional/find_functional_tests.py b/pylint/testutils/functional/find_functional_tests.py index b40fbbbde..0b4dd49e0 100644 --- a/pylint/testutils/functional/find_functional_tests.py +++ b/pylint/testutils/functional/find_functional_tests.py @@ -10,7 +10,7 @@ from pathlib import Path from pylint.testutils.functional.test_file import FunctionalTestFile -REASONABLY_DISPLAYABLE_VERTICALLY = 48 +REASONABLY_DISPLAYABLE_VERTICALLY = 49 """'Wet finger' number of files that are reasonable to display by an IDE.""" SHOULD_BE_IN_THE_SAME_DIRECTORY = 5 """'Wet finger' as in 'in my settings there are precisely this many'.""" @@ -62,17 +62,21 @@ def _check_functional_tests_structure(directory: Path) -> None: dirs: set[Path] = set() def walk(path: Path) -> Iterator[Path]: + violations: list[tuple[Path, int]] = [] for _file_or_dir in path.iterdir(): if _file_or_dir.is_dir(): _files = list(_file_or_dir.iterdir()) - assert len(_files) <= REASONABLY_DISPLAYABLE_VERTICALLY, ( - f"{_file_or_dir} contains too many functional tests files " - + f"({len(_files)} > {REASONABLY_DISPLAYABLE_VERTICALLY})." - ) + if len(_files) > REASONABLY_DISPLAYABLE_VERTICALLY: + violations.append((_file_or_dir, len(_files))) yield _file_or_dir yield from walk(_file_or_dir) else: yield _file_or_dir.resolve() + if violations: + _msg = "The following directory contains too many functional tests files:\n" + for offending_file, number in violations: + _msg += f"- {offending_file}: ({number}) > {REASONABLY_DISPLAYABLE_VERTICALLY}\n" + raise AssertionError(_msg) # Collect all sub-directories and files in directory for file_or_dir in walk(directory): |