summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2020-05-02 14:04:46 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2020-05-02 17:56:25 +0200
commitbe34516a497031f8207dd52e69b4b573eb313db9 (patch)
tree0347caf14a5d10e8580a0486a8eec20c733ae300
parent54ce3bae10ce545a9f98272bba45e122e7ebaffa (diff)
downloadpylint-git-be34516a497031f8207dd52e69b4b573eb313db9.tar.gz
Allow linting directories without `__init__.py`
This was a regressin in 2.5. Close #3528
-rw-r--r--ChangeLog4
-rw-r--r--pylint/utils/utils.py2
-rw-r--r--tests/test_self.py15
3 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9740612d9..3c45f2966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,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?
===========================
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index fd0c49355..658316cf2 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -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:
diff --git a/tests/test_self.py b/tests/test_self.py
index 296d93e74..d843efe40 100644
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -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,
+ )