File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
pylint/testutils/functional Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 15
15
directory.
16
16
17
17
'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
19
19
avoid moving a lot of files.
20
20
"""
21
21
@@ -75,7 +75,7 @@ def _get_files_from_dir(
75
75
files_without_leading_underscore = list (
76
76
p
77
77
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" ))
79
79
)
80
80
if len (files_without_leading_underscore ) > max_file_per_directory :
81
81
violations .append ((path , len (files_without_leading_underscore )))
@@ -90,7 +90,6 @@ def walk(path: Path) -> Iterator[Path]:
90
90
)
91
91
for _file_or_dir in parent_dir_files :
92
92
if _file_or_dir .is_dir ():
93
- _files = _get_files_from_dir (_file_or_dir , violations )
94
93
yield _file_or_dir .resolve ()
95
94
try :
96
95
yield from walk (_file_or_dir )
Original file line number Diff line number Diff line change @@ -85,13 +85,14 @@ def test_get_functional_test_files_from_crowded_directory() -> None:
85
85
get_functional_test_files_from_directory (
86
86
DATA_DIRECTORY / "m" , max_file_per_directory = 1
87
87
)
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
90
91
with pytest .raises (AssertionError ) as exc_info :
91
92
get_functional_test_files_from_directory (
92
- DATA_DIRECTORY / "m" , max_file_per_directory = 3
93
+ DATA_DIRECTORY / "m" , max_file_per_directory = 2
93
94
)
94
- assert exc_info .match ("m: 4 when the max is 3 " )
95
+ assert exc_info .match ("m: 3 when the max is 2 " )
95
96
assert "max_overflow" not in str (exc_info .value )
96
97
97
98
You can’t perform that action at this time.
0 commit comments