Skip to content

import-self false positive when importing non-existing module from current package #3748

Open
@vlad0337187

Description

@vlad0337187

Steps to reproduce

  1. create some module
  2. try to import non-existing module from current package in __init__.py
  3. run pylint ./

Current behavior

  • raises W0406: Module import itself (import-self)

Expected behavior

  • should raise something like X0000: Module import not found (import-missing)

pylint --version output

pylint 2.5.3
astroid 2.4.2
Python 3.8.3 (default, May 29 2020, 00:00:00) 
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]

Reproduce case

  • download this .zip: pylint_false_positive_import_self.zip
  • unpack it
  • make unpacked directory - current (cd command)
  • run pipenv install (to install pylint, create venv)
  • run pipenv run pylint ./

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeImport systemNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions