Skip to content

Commit

Permalink
Allow linting directories without __init__.py
Browse files Browse the repository at this point in the history
This was a regressin in 2.5.
Close #3528
  • Loading branch information
PCManticore committed May 2, 2020
1 parent 385ce42 commit 716bcc4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Release date: TBA

Close #3524

* Allow linting directories without `__init__.py` which was a regression in 2.5.

Close #3528

What's New in Pylint 2.5.0?
===========================

Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def expand_modules(files_or_modules, black_list, black_list_re):
continue

module_path = get_python_path(something)
additional_search_path = [module_path] + path
additional_search_path = [".", module_path] + path
if os.path.exists(something):
# this is a file or a directory
try:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,18 @@ def test_allow_import_of_files_found_in_modules_during_parallel_check(self, tmpd
],
code=0,
)

def test_can_list_directories_without_dunder_init(self, tmpdir):
test_directory = tmpdir / "test_directory"
test_directory.mkdir()
spam_module = test_directory / "spam.py"
spam_module.write("'Empty'")

with tmpdir.as_cwd():
self._runtest(
[
"--disable=missing-docstring, missing-final-newline",
"test_directory",
],
code=0,
)

0 comments on commit 716bcc4

Please sign in to comment.