From 60dc4441f52dcf9d3ffd78b37be304bdce84b87e Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Tue, 1 Dec 2015 14:58:59 +0200 Subject: Don't emit import-self and cyclic-import for relative imports of modules with the same name as the package itself. The problem was partially the fault of astroid.modutils.get_module_part, in combination with a given context file. The function returned 'dummy' as the module part for the string `dummy.dummy.Dummy`, which is in fact true, since the first dummy is the package and the second dummy is the module from where Dummy gets loaded. But get_module_part has no way to know this semantic inference, that the second dummy is a relative import inside the first one. As such, it's better to just skip the check if the condition of being relative inside a __init__.py file is found, since there's no way to load itself in that case. Closes issues #708 and #706. --- pylint/test/regrtest_data/dummy/another.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 pylint/test/regrtest_data/dummy/another.py (limited to 'pylint/test/regrtest_data/dummy/another.py') diff --git a/pylint/test/regrtest_data/dummy/another.py b/pylint/test/regrtest_data/dummy/another.py new file mode 100644 index 0000000..046b447 --- /dev/null +++ b/pylint/test/regrtest_data/dummy/another.py @@ -0,0 +1,4 @@ +# pylint: disable=missing-docstring + +ANOTHER = 42 + -- cgit v1.2.1