Skip to content

Commit ae1e433

Browse files
committed
Fix tests
1 parent 56392fe commit ae1e433

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pylint/testutils/functional/find_functional_tests.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
directory.
1616
1717
'Wet finger' as in 'in my settings there are precisely this many'.
18-
Initially the total number of file then we started counting only the python files to
18+
Initially the total number of files then we started counting only the python files to
1919
avoid moving a lot of files.
2020
"""
2121

@@ -75,7 +75,7 @@ def _get_files_from_dir(
7575
files_without_leading_underscore = list(
7676
p
7777
for p in path.iterdir()
78-
if not p.stem.startswith("_") and p.suffix == ".py"
78+
if not (p.stem.startswith("_") or (p.is_file() and p.suffix != ".py"))
7979
)
8080
if len(files_without_leading_underscore) > max_file_per_directory:
8181
violations.append((path, len(files_without_leading_underscore)))
@@ -90,7 +90,6 @@ def walk(path: Path) -> Iterator[Path]:
9090
)
9191
for _file_or_dir in parent_dir_files:
9292
if _file_or_dir.is_dir():
93-
_files = _get_files_from_dir(_file_or_dir, violations)
9493
yield _file_or_dir.resolve()
9594
try:
9695
yield from walk(_file_or_dir)

tests/testutils/data/m/max_overflow/max_overflow_3.py

Whitespace-only changes.

tests/testutils/test_functional_testutils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ def test_get_functional_test_files_from_crowded_directory() -> None:
8585
get_functional_test_files_from_directory(
8686
DATA_DIRECTORY / "m", max_file_per_directory=1
8787
)
88-
assert exc_info.match("m: 4 when the max is 1")
89-
assert exc_info.match("max_overflow: 3 when the max is 1")
88+
assert exc_info.match("m: 3 when the max is 1")
89+
assert exc_info.match("max_overflow: 2 when the max is 1")
90+
assert len(exc_info.value.args[0].splitlines()) == 3
9091
with pytest.raises(AssertionError) as exc_info:
9192
get_functional_test_files_from_directory(
92-
DATA_DIRECTORY / "m", max_file_per_directory=3
93+
DATA_DIRECTORY / "m", max_file_per_directory=2
9394
)
94-
assert exc_info.match("m: 4 when the max is 3")
95+
assert exc_info.match("m: 3 when the max is 2")
9596
assert "max_overflow" not in str(exc_info.value)
9697

9798

0 commit comments

Comments
 (0)