diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | pylint/checkers/classes.py | 2 | ||||
-rw-r--r-- | pylint/test/functional/init_not_called.py | 7 |
3 files changed, 10 insertions, 3 deletions
@@ -222,7 +222,9 @@ ChangeLog for Pylint * Improve detection of relative imports in non-packages, as well as importing missing modules with a relative import from a package. - + + * Don't emit no-init if not all the bases from a class are known. + Closes issue #604. diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index c4f7ff0..edbc36b 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -307,7 +307,7 @@ a metaclass class method.'} self._accessed.append(defaultdict(list)) self._check_bases_classes(node) # if not an exception or a metaclass - if node.type == 'class': + if node.type == 'class' and helpers.has_known_bases(node): try: node.local_attr('__init__') except astroid.NotFoundError: diff --git a/pylint/test/functional/init_not_called.py b/pylint/test/functional/init_not_called.py index e22be39..43629c7 100644 --- a/pylint/test/functional/init_not_called.py +++ b/pylint/test/functional/init_not_called.py @@ -1,4 +1,4 @@ -# pylint: disable=R0903 +# pylint: disable=R0903,import-error, missing-docstring """test for __init__ not called """ from __future__ import print_function @@ -57,3 +57,8 @@ class AssignedInit(NewStyleC): """No init called.""" def __init__(self): # [super-init-not-called] self.arg = 0 + +from missing import Missing + +class UnknownBases(Missing): + """Don't emit no-init if the bases aren't known.""" |