Allow linting directories without __init__.py

This was a regressin in 2.5.
Close #3528
This commit is contained in:
Claudiu Popa 2020-05-02 14:04:46 +02:00
parent 385ce42419
commit 716bcc4e0e
3 changed files with 20 additions and 1 deletions

View File

@ -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?
===========================

View File

@ -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:

View File

@ -763,3 +763,18 @@ class TestRunTC:
],
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,
)