Open
Description
Steps to reproduce
- applying the following patch and running the two tests leads to one failure and one pass
- def test_can_list_directories_without_dunder_init(self, tmpdir):
+ @pytest.mark.parametrize("modname", ['warning', 'warnings'])
+ def test_can_list_directories_without_dunder_init(self, tmpdir, modname):
test_directory = tmpdir / "test_directory"
test_directory.mkdir()
- spam_module = test_directory / "spam.py"
- spam_module.write("'Empty'")
+ l_module = test_directory / "logging.py"
+ l_module.write(f"'Empty'\nfrom .{modname} import A\nprint(A)")
+ w_module = test_directory / f"{modname}.py"
+ w_module.write("'Empty'\nA=3")
Current behavior
tests/self/test_run.py::TestRunTC::test_can_list_directories_without_dunder_init[warning] PASSED [ 50%]
tests/self/test_run.py::TestRunTC::test_can_list_directories_without_dunder_init[warnings] FAILED
...
E AssertionError: expected output status 0, got 2. Below pylint output:
E ************* Module logging
E test_directory/logging.py:2:0: E0402: Attempted relative import beyond top-level package (relative-beyond-top-level)
E
E ---------------------------------------------------------------------
E Your code has been rated at -6.67/10 (previous run: -10.00/10, +3.33)
Expected behavior
Both tests pass, i.e., there should be no special handling of modules that are named after stdlib modules.
pylint --version output
pylint 2.6.0-dev1
astroid 2.5.0
Python 3.8.2 | packaged by conda-forge | (default, Apr 24 2020, 08:20:52)
[GCC 7.3.0]