From 9a753911b15667aa0550af8f6acc9ab8424b33e0 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Wed, 2 Feb 2022 00:00:05 +0100 Subject: [PATCH] wip --- pylint/testutils/functional/find_functional_tests.py | 9 ++++----- tests/testutils/test_functional_testutils.py | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pylint/testutils/functional/find_functional_tests.py b/pylint/testutils/functional/find_functional_tests.py index 2540e7f19c7..4237d541e39 100644 --- a/pylint/testutils/functional/find_functional_tests.py +++ b/pylint/testutils/functional/find_functional_tests.py @@ -22,9 +22,6 @@ def get_functional_test_files_from_directory( for dirpath, dirnames, filenames in os.walk(input_dir): if dirpath.endswith("__pycache__"): continue - if Path(dirpath).stem.startswith("_"): - break - _test_structure_of_dir(Path(dirpath)) check_functional_tests_structure( dirpath, dirnames, @@ -40,7 +37,7 @@ def get_functional_test_files_from_directory( def check_functional_tests_structure( dirpath: str, - dirnames: List[str], + dirnames: List[str], # pylint: disable=unused-argument filenames: List[str], input_dir: str, reasonably_displayable_vertically: int, @@ -50,8 +47,10 @@ def check_functional_tests_structure( ), f"{dirpath} contains too many functional tests files." if dirpath == input_dir: return + if Path(dirpath).stem.startswith("_"): + return + _test_structure_of_dir(Path(dirpath)) last_dir_name = dirpath.split("/")[-1].lstrip() - print(f"{dirpath=} {dirnames=} {filenames=} {last_dir_name=}") for filename in filenames: if filename.startswith("__"): return diff --git a/tests/testutils/test_functional_testutils.py b/tests/testutils/test_functional_testutils.py index d7331cb6ed9..e81f165ad29 100644 --- a/tests/testutils/test_functional_testutils.py +++ b/tests/testutils/test_functional_testutils.py @@ -25,10 +25,5 @@ def test_parsing_of_pylintrc_init_hook() -> None: def test_get_functional_test_files_from_directory() -> None: - assert len(get_functional_test_files_from_directory(DATA_DIRECTORY)) == 5 - - -def test_get_functional_test_files_from_subdirectory() -> None: - assert ( - len(get_functional_test_files_from_directory(DATA_DIRECTORY / "u" / "use")) == 2 - ) + with pytest.raises(AssertionError, match="using_dir.py should not go in"): + get_functional_test_files_from_directory(DATA_DIRECTORY)