Skip to content

Commit be34516

Browse files
committed
Allow linting directories without __init__.py
This was a regressin in 2.5. Close #3528
1 parent 54ce3ba commit be34516

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Release date: TBA
2525

2626
Close #3524
2727

28+
* Allow linting directories without `__init__.py` which was a regression in 2.5.
29+
30+
Close #3528
31+
2832
What's New in Pylint 2.5.0?
2933
===========================
3034

pylint/utils/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def expand_modules(files_or_modules, black_list, black_list_re):
142142
continue
143143

144144
module_path = get_python_path(something)
145-
additional_search_path = [module_path] + path
145+
additional_search_path = [".", module_path] + path
146146
if os.path.exists(something):
147147
# this is a file or a directory
148148
try:

tests/test_self.py

+15
Original file line numberDiff line numberDiff line change
@@ -763,3 +763,18 @@ def test_allow_import_of_files_found_in_modules_during_parallel_check(self, tmpd
763763
],
764764
code=0,
765765
)
766+
767+
def test_can_list_directories_without_dunder_init(self, tmpdir):
768+
test_directory = tmpdir / "test_directory"
769+
test_directory.mkdir()
770+
spam_module = test_directory / "spam.py"
771+
spam_module.write("'Empty'")
772+
773+
with tmpdir.as_cwd():
774+
self._runtest(
775+
[
776+
"--disable=missing-docstring, missing-final-newline",
777+
"test_directory",
778+
],
779+
code=0,
780+
)

0 commit comments

Comments
 (0)