Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1695727 - python-astroid-2.2.5-1.fc31 FTBFS with Python 3.8
Summary: python-astroid-2.2.5-1.fc31 FTBFS with Python 3.8
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-astroid
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON38
TreeView+ depends on / blocked
 
Reported: 2019-04-03 17:00 UTC by Miro Hrončok
Modified: 2019-04-04 08:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-04 08:28:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Full log from Copr (205.79 KB, text/plain)
2019-04-03 17:00 UTC, Miro Hrončok
no flags Details

Description Miro Hrončok 2019-04-03 17:00:21 UTC
Created attachment 1551444 [details]
Full log from Copr

There are 12 test failures on Python 3.8:

=================================== FAILURES ===================================
____________________ FromToLineNoTest.test_callfunc_lineno _____________________
self = <astroid.tests.unittest_builder.FromToLineNoTest testMethod=test_callfunc_lineno>
    def test_callfunc_lineno(self):
        stmts = self.astroid.body
        # on line 4:
        #    function('aeozrijz\
        #    earzer', hop)
        discard = stmts[0]
        self.assertIsInstance(discard, nodes.Expr)
        self.assertEqual(discard.fromlineno, 4)
        self.assertEqual(discard.tolineno, 5)
        callfunc = discard.value
        self.assertIsInstance(callfunc, nodes.Call)
        self.assertEqual(callfunc.fromlineno, 4)
        self.assertEqual(callfunc.tolineno, 5)
        name = callfunc.func
        self.assertIsInstance(name, nodes.Name)
        self.assertEqual(name.fromlineno, 4)
        self.assertEqual(name.tolineno, 4)
        strarg = callfunc.args[0]
        self.assertIsInstance(strarg, nodes.Const)
        if hasattr(sys, "pypy_version_info"):
            lineno = 4
        else:
            lineno = 5  # no way for this one in CPython (is 4 actually)
>       self.assertEqual(strarg.fromlineno, lineno)
E       AssertionError: 4 != 5
astroid/tests/unittest_builder.py:63: AssertionError
_______________ FromToLineNoTest.test_decorated_function_lineno ________________
self = <astroid.tests.unittest_builder.FromToLineNoTest testMethod=test_decorated_function_lineno>
    def test_decorated_function_lineno(self):
        astroid = builder.parse(
            """
            @decorator
            def function(
                arg):
                print (arg)
            """,
            __name__,
        )
        function = astroid["function"]
        # XXX discussable, but that's what is expected by pylint right now
>       self.assertEqual(function.fromlineno, 3)
E       AssertionError: 4 != 3
astroid/tests/unittest_builder.py:126: AssertionError
______________ TestHelpers.test_object_type_classes_and_functions ______________
self = <astroid.tests.unittest_helpers.TestHelpers testMethod=test_object_type_classes_and_functions>
    def test_object_type_classes_and_functions(self):
        ast_nodes = builder.extract_node(
            """
        def generator():
            yield
    
        class A(object):
            def test(self):
                self #@
            @classmethod
            def cls_method(cls): pass
            @staticmethod
            def static_method(): pass
        A #@
        A() #@
        A.test #@
        A().test #@
        A.cls_method #@
        A().cls_method #@
        A.static_method #@
        A().static_method #@
        generator() #@
        """
        )
        from_self = helpers.object_type(ast_nodes[0])
        cls = next(ast_nodes[1].infer())
>       self.assert_classes_equal(from_self, cls)
astroid/tests/unittest_helpers.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astroid/tests/unittest_helpers.py:36: in assert_classes_equal
    self.assertEqual(cls.name, other.name)
E   AssertionError: 'A' != 'static_method'
E   - A
E   + static_method
____________________ TestBool.test_bool_bool_special_method ____________________
self = <astroid.tests.unittest_inference.TestBool testMethod=test_bool_bool_special_method>
    def test_bool_bool_special_method(self):
        ast_nodes = extract_node(
            """
        class FalseClass:
           def {method}(self):
               return False
        class TrueClass:
           def {method}(self):
               return True
        class C(object):
           def __call__(self):
               return False
        class B(object):
           {method} = C()
        class LambdaBoolFalse(object):
            {method} = lambda self: self.foo
            @property
            def foo(self): return 0
        class FalseBoolLen(object):
            __len__ = lambda self: self.foo
            @property
            def foo(self): return 0
        bool(FalseClass) #@
        bool(TrueClass) #@
        bool(FalseClass()) #@
        bool(TrueClass()) #@
        bool(B()) #@
        bool(LambdaBoolFalse()) #@
        bool(FalseBoolLen()) #@
        """.format(
                method=BOOL_SPECIAL_METHOD
            )
        )
        expected = [True, True, False, True, False, False, False]
        for node, expected_value in zip(ast_nodes, expected):
            inferred = next(node.infer())
>           self.assertEqual(inferred.value, expected_value)
E           AttributeError: 'FunctionDef' object has no attribute 'value'
astroid/tests/unittest_inference.py:4344: AttributeError
 FunctionModelTest.test_builtin_dunder_init_does_not_crash_when_accessing_annotations 
self = <astroid.tests.unittest_object_model.FunctionModelTest testMethod=test_builtin_dunder_init_does_not_crash_when_accessing_annotations>
    @test_utils.require_version(minver="3.0")
    def test_builtin_dunder_init_does_not_crash_when_accessing_annotations(self):
        ast_node = builder.extract_node(
            """
        class Class:
            @classmethod
            def class_method(cls):
                cls.__init__.__annotations__ #@
        """
        )
        inferred = next(ast_node.infer())
>       self.assertIsInstance(inferred, astroid.Dict)
E       AssertionError: <FunctionDef.class_method l.5 at 0x7fb4b4523bb0> is not an instance of <class 'astroid.node_classes.Dict'>
astroid/tests/unittest_object_model.py:470: AssertionError
______________________ SuperTests.test_no_arguments_super ______________________
self = <astroid.tests.unittest_objects.SuperTests testMethod=test_no_arguments_super>
    @test_utils.require_version(minver="3.0")
    def test_no_arguments_super(self):
        ast_nodes = builder.extract_node(
            """
        class First(object): pass
        class Second(First):
            def test(self):
                super() #@
            @classmethod
            def test_classmethod(cls):
                super() #@
        """
        )
        first = next(ast_nodes[0].infer())
        self.assertIsInstance(first, objects.Super)
        self.assertIsInstance(first.type, bases.Instance)
        self.assertEqual(first.type.name, "Second")
        self.assertIsInstance(first.mro_pointer, nodes.ClassDef)
        self.assertEqual(first.mro_pointer.name, "Second")
    
        second = next(ast_nodes[1].infer())
>       self.assertIsInstance(second, objects.Super)
E       AssertionError: <FunctionDef.test_classmethod l.8 at 0x7fb4b3803160> is not an instance of <class 'astroid.objects.Super'>
astroid/tests/unittest_objects.py:142: AssertionError
______________________ SuperTests.test_super_bound_model _______________________
self = <astroid.tests.unittest_objects.SuperTests testMethod=test_super_bound_model>
    def test_super_bound_model(self):
        ast_nodes = builder.extract_node(
            """
        class First(object):
            def method(self):
                pass
            @classmethod
            def class_method(cls):
                pass
        class Super_Type_Type(First):
            def method(self):
                super(Super_Type_Type, Super_Type_Type).method #@
                super(Super_Type_Type, Super_Type_Type).class_method #@
            @classmethod
            def class_method(cls):
                super(Super_Type_Type, Super_Type_Type).method #@
                super(Super_Type_Type, Super_Type_Type).class_method #@
    
        class Super_Type_Object(First):
            def method(self):
                super(Super_Type_Object, self).method #@
                super(Super_Type_Object, self).class_method #@
        """
        )
        # Super(type, type) is the same for both functions and classmethods.
        first = next(ast_nodes[0].infer())
        self.assertIsInstance(first, nodes.FunctionDef)
        self.assertEqual(first.name, "method")
    
        second = next(ast_nodes[1].infer())
        self.assertIsInstance(second, bases.BoundMethod)
        self.assertEqual(second.bound.name, "First")
        self.assertEqual(second.type, "classmethod")
    
        third = next(ast_nodes[2].infer())
        self.assertIsInstance(third, nodes.FunctionDef)
>       self.assertEqual(third.name, "method")
E       AssertionError: 'class_method' != 'method'
E       - class_method
E       + method
astroid/tests/unittest_objects.py:303: AssertionError
_______ NonRegressionTests.test_decorator_names_inference_error_leaking ________
self = <astroid.tests.unittest_regrtest.NonRegressionTests testMethod=test_decorator_names_inference_error_leaking>
    def test_decorator_names_inference_error_leaking(self):
        node = extract_node(
            """
        class Parent(object):
            @property
            def foo(self):
                pass
    
        class Child(Parent):
            @Parent.foo.getter
            def foo(self): #@
                return super(Child, self).foo + ['oink']
        """
        )
>       inferred = next(node.infer())
astroid/tests/unittest_regrtest.py:271: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astroid/node_classes.py:353: in infer
    return self._infer(context, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <Decorators l.9 at 0x7fb4b333f130>, context = None
    def _infer(self, context=None):
        """we don't know how to resolve a statement by default"""
        # this method is overridden by most concrete classes
>       raise exceptions.InferenceError(
            "No inference function for {node!r}.", node=self, context=context
        )
E       astroid.exceptions.InferenceError: No inference function for <Decorators l.9 at 0x7fb4b333f130>.
astroid/node_classes.py:731: InferenceError
___________ FunctionNodeTest.test_dunder_class_local_to_classmethod ____________
self = <astroid.tests.unittest_scoped_nodes.FunctionNodeTest testMethod=test_dunder_class_local_to_classmethod>
    @test_utils.require_version(minver="3.0")
    def test_dunder_class_local_to_classmethod(self):
        node = builder.extract_node(
            """
        class MyClass:
            @classmethod
            def test(cls):
                __class__ #@
        """
        )
        inferred = next(node.infer())
>       self.assertIsInstance(inferred, nodes.ClassDef)
E       AssertionError: <FunctionDef.test l.5 at 0x7fb4b2e294f0> is not an instance of <class 'astroid.scoped_nodes.ClassDef'>
astroid/tests/unittest_scoped_nodes.py:667: AssertionError
_________________ FunctionNodeTest.test_is_abstract_decorated __________________
self = <astroid.tests.unittest_scoped_nodes.FunctionNodeTest testMethod=test_is_abstract_decorated>
    def test_is_abstract_decorated(self):
        methods = builder.extract_node(
            """
            import abc
    
            class Klass(object):
                @abc.abstractproperty
                def prop(self):  #@
                   pass
    
                @abc.abstractmethod
                def method1(self):  #@
                   pass
    
                some_other_decorator = lambda x: x
                @some_other_decorator
                def method2(self):  #@
                   pass
         """
        )
>       self.assertTrue(methods[0].is_abstract(pass_is_abstract=False))
E       AttributeError: 'Decorators' object has no attribute 'is_abstract'
astroid/tests/unittest_scoped_nodes.py:392: AttributeError
______________ ClassNodeTest.test_function_with_decorator_lineno _______________
self = <astroid.tests.unittest_scoped_nodes.ClassNodeTest testMethod=test_function_with_decorator_lineno>
    def test_function_with_decorator_lineno(self):
        data = """
            @f(a=2,
               b=3)
            def g1(x):
                print(x)
    
            @f(a=2,
               b=3)
            def g2():
                pass
        """
        astroid = builder.parse(data)
>       self.assertEqual(astroid["g1"].fromlineno, 4)
E       AssertionError: 6 != 4
astroid/tests/unittest_scoped_nodes.py:1028: AssertionError
__________ ClassNodeTest.test_generator_from_infer_call_result_parent __________
self = <astroid.tests.unittest_scoped_nodes.ClassNodeTest testMethod=test_generator_from_infer_call_result_parent>
    def test_generator_from_infer_call_result_parent(self):
        func = builder.extract_node(
            """
        import contextlib
    
        @contextlib.contextmanager
        def test(): #@
            yield
        """
        )
>       result = next(func.infer_call_result())
E       AttributeError: 'Decorators' object has no attribute 'infer_call_result'
astroid/tests/unittest_scoped_nodes.py:1649: AttributeError


Full log attached. This blocks the 3.8 bootstrapping.

Comment 1 Miro Hrončok 2019-04-03 17:10:49 UTC
I don't get them with tox in upstream master or 2.2.5:

$ git checkout astroid-2.2.5
$ tox -e py38
...
809 passed, 58 skipped, 15 xfailed, 1 xpassed in 12.96 seconds
  py38: commands succeeded
  congratulations :)

Comment 2 Miro Hrončok 2019-04-03 17:24:18 UTC
I can reproduce the problem upstream iff typed_ast is not installed.

Comment 4 Christian Dersch 2019-04-04 08:28:38 UTC
Thanks! Merged the pull request and rebuilt the package: https://koji.fedoraproject.org/koji/taskinfo?taskID=33947688


Note You need to log in before you can comment on or make changes to this bug.