From f0a92406dbb9fded2c645e8a1695ec22377885be Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 2 Jul 2022 12:22:57 -0400 Subject: [PATCH 1/3] Add regression test for #1667 --- doc/whatsnew/2/2.15/index.rst | 4 ++++ tests/lint/unittest_lint.py | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index dc358063f4..561caa70bf 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -74,6 +74,10 @@ False negatives fixed Other bug fixes =============== +* Fix a failure to lint namespace packages contained in directories lacking ``__init__.py``. + + Closes #1667 + Other Changes ============= diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index 3dbde39cec..3836db3616 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -931,3 +931,12 @@ def test_import_sibling_module_from_namespace(initialized_linter: PyLinter) -> N with fix_import_path([tmpdir]): linter.check(["submodule2.py"]) assert not linter.stats.by_msg + + +def test_lint_namespace_package_under_dir(initialized_linter: PyLinter) -> None: + """Regression test for https://github.com/PyCQA/pylint/issues/1667""" + linter = initialized_linter + with tempdir(): + create_files(["outer/namespace/__init__.py", "outer/namespace/module.py"]) + linter.check(["outer.namespace"]) + assert not linter.stats.by_msg From 89dc6fb1536327dce0a34ccac7bd097cbc445647 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Wed, 13 Jul 2022 07:25:03 -0400 Subject: [PATCH 2/3] avoid "namespace" language --- doc/whatsnew/2/2.15/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index 561caa70bf..2b7ebe53ee 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -74,7 +74,7 @@ False negatives fixed Other bug fixes =============== -* Fix a failure to lint namespace packages contained in directories lacking ``__init__.py``. +* Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``. Closes #1667 From dbd1760fcfb48855b7c34535542fd23529caf9fc Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sun, 17 Jul 2022 17:50:04 -0400 Subject: [PATCH 3/3] add news --- doc/whatsnew/fragments/1667.bugfix | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/whatsnew/fragments/1667.bugfix diff --git a/doc/whatsnew/fragments/1667.bugfix b/doc/whatsnew/fragments/1667.bugfix new file mode 100644 index 0000000000..f4e3eeec5c --- /dev/null +++ b/doc/whatsnew/fragments/1667.bugfix @@ -0,0 +1,3 @@ +Fix a failure to lint packages with ``__init__.py`` contained in directories lacking ``__init__.py``. + +Closes #1667