Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures with Python 3.9 #845

Closed
kulikjak opened this issue Oct 14, 2020 · 2 comments
Closed

Test failures with Python 3.9 #845

kulikjak opened this issue Oct 14, 2020 · 2 comments

Comments

@kulikjak
Copy link

kulikjak commented Oct 14, 2020

With current astroid (version 2.4.2) we are experiencing 4 test failures when running with Python 3.9.0. Sadly, I don't see into astroid, hence I couldn't find the root cause, but I am ready to help with debugging.

________________________ TypingBrain.test_namedtuple_few_args ________________________

self = <tests.unittest_brain.TypingBrain testMethod=test_namedtuple_few_args>

    def test_namedtuple_few_args(self):
        result = builder.extract_node(
            """
        from typing import NamedTuple
        NamedTuple("A")
        """
        )
        inferred = next(result.infer())
>       self.assertIsInstance(inferred, astroid.Instance)
E       AssertionError: Uninferable is not an instance of <class 'astroid.bases.Instance'>

tests/unittest_brain.py:1021: AssertionError
_______________________ TypingBrain.test_namedtuple_few_fields _______________________

self = <tests.unittest_brain.TypingBrain testMethod=test_namedtuple_few_fields>

    def test_namedtuple_few_fields(self):
        result = builder.extract_node(
            """
        from typing import NamedTuple
        NamedTuple("A", [("a",), ("b", str), ("c", bytes)])
        """
        )
        inferred = next(result.infer())
>       self.assertIsInstance(inferred, astroid.Instance)
E       AssertionError: Uninferable is not an instance of <class 'astroid.bases.Instance'>

tests/unittest_brain.py:1032: AssertionError
__________________ TypingBrain.test_namedtuple_inference_nonliteral __________________

self = <tests.unittest_brain.TypingBrain testMethod=test_namedtuple_inference_nonliteral>

    def test_namedtuple_inference_nonliteral(self):
        # Note: NamedTuples in mypy only work with literals.
        klass = builder.extract_node(
            """
        from typing import NamedTuple
    
        name = "X"
        fields = [("a", int), ("b", str), ("c", bytes)]
        NamedTuple(name, fields)
        """
        )
        inferred = next(klass.infer())
>       self.assertIsInstance(inferred, astroid.Instance)
E       AssertionError: Uninferable is not an instance of <class 'astroid.bases.Instance'>

tests/unittest_brain.py:988: AssertionError
________________ test_dataclasses_subscript_inference_recursion_error ________________

    @pytest.mark.skipif(sys.version_info < (3, 8), reason="Needs dataclasses available")
    def test_dataclasses_subscript_inference_recursion_error():
        code = """
        from dataclasses import dataclass, replace
    
        @dataclass
        class ProxyConfig:
            auth: str = "/auth"
    
    
        a = ProxyConfig("")
        test_dict = {"proxy" : {"auth" : "", "bla" : "f"}}
    
        foo = test_dict['proxy']
        replace(a, **test_dict['proxy']) # This fails
        """
        node = extract_node(code)
        # Reproduces only with safe_infer()
>       assert helpers.safe_infer(node) is None
E       assert Uninferable is None
E        +  where Uninferable = <function safe_infer at 0x7fca603b4040>(<Call l.13 at 0x7fca4e6fc1f0>)
E        +    where <function safe_infer at 0x7fca603b4040> = helpers.safe_infer

tests/unittest_inference.py:5691: AssertionError
====== 4 failed, 908 passed, 6 skipped, 14 xfailed, 1 xpassed in 35.69 seconds =======
@hippo91
Copy link
Contributor

hippo91 commented Oct 17, 2020

@kulikjak thanks for your report. Currently we do not support python 3.9 yet. But we should work on it ASAP.

@kulikjak
Copy link
Author

With patches from recently merged #858 and #829, the test suite for Python 3.9 is green again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants