Skip to content

Commit 5784fd7

Browse files
committed
Fix tests
1 parent 56392fe commit 5784fd7

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

pylint/testutils/functional/find_functional_tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ 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")
9090
with pytest.raises(AssertionError) as exc_info:
9191
get_functional_test_files_from_directory(
92-
DATA_DIRECTORY / "m", max_file_per_directory=3
92+
DATA_DIRECTORY / "m", max_file_per_directory=2
9393
)
94-
assert exc_info.match("m: 4 when the max is 3")
94+
assert exc_info.match("m: 3 when the max is 2")
9595
assert "max_overflow" not in str(exc_info.value)
9696

9797

0 commit comments

Comments
 (0)