diff options
-rw-r--r-- | pylint/checkers/variables.py | 2 | ||||
-rw-r--r-- | pylint/test/functional/unused_import.py | 4 | ||||
-rw-r--r-- | pylint/test/functional/unused_import.txt | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index 9cc747d..e2d4ecc 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -43,7 +43,7 @@ def _is_from_future_import(stmt, name): """Check if the name is a future import from another module.""" try: module = stmt.do_import_module(stmt.modname) - except InferenceError: + except astroid.InferenceError: return for local_node in module.locals.get(name, []): diff --git a/pylint/test/functional/unused_import.py b/pylint/test/functional/unused_import.py index 8979006..bec7fe9 100644 --- a/pylint/test/functional/unused_import.py +++ b/pylint/test/functional/unused_import.py @@ -9,8 +9,10 @@ from sys import flags # [unused-import] from collections import deque, OrderedDict, Counter DATA = Counter() -from fake import SomeName +from fake import SomeName, SomeOtherName # [unused-import] class SomeClass(object): SomeName = SomeName # https://bitbucket.org/logilab/pylint/issue/475 + SomeOtherName = 1 + SomeOtherName = SomeOtherName from never import __all__ diff --git a/pylint/test/functional/unused_import.txt b/pylint/test/functional/unused_import.txt index b2b79e0..9d6497f 100644 --- a/pylint/test/functional/unused_import.txt +++ b/pylint/test/functional/unused_import.txt @@ -5,3 +5,4 @@ unused-import:6::Unused argv imported from sys as test2 unused-import:7::Unused flags imported from sys unused-import:9::Unused OrderedDict imported from collections unused-import:9::Unused deque imported from collections +unused-import:12::Unused SomeOtherName imported from fake |