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 failure on 3.14 #2641

Open
limburgher opened this issue Nov 21, 2024 · 3 comments
Open

Test failure on 3.14 #2641

limburgher opened this issue Nov 21, 2024 · 3 comments
Labels
Blocked 🚧 A PR or issue blocked by another PR or issue Bug 🪳 python 3.14

Comments

@limburgher
Copy link
Contributor

See: https://bugzilla.redhat.com/show_bug.cgi?id=2323166

=================================== FAILURES ===================================
___________ CollectionsBrain.test_collections_object_subscriptable_3 ___________

args = (<Attribute.ByteString l.3 at 0x7f75c592dbd0>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c59adae0>}
generator = <generator object Attribute._infer at 0x7f75c591cbf0>

def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
    generator = func(*args, **kwargs)
    try:
      yield next(generator)

E StopIteration

astroid/decorators.py:86: StopIteration

The above exception was the direct cause of the following exception:

self = <tests.brain.test_brain.CollectionsBrain testMethod=test_collections_object_subscriptable_3>

def test_collections_object_subscriptable_3(self):
    """With Python 3.9 the ByteString class of the collections module is subscriptable
    (but not the same class from typing module)"""
    right_node = builder.extract_node(
        """
    import collections.abc
    collections.abc.ByteString[int]
    """
    )
  inferred = next(right_node.infer())

tests/brain/test_brain.py:331:


astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):
astroid/decorators.py:86: in inner
yield next(generator)
astroid/decorators.py:49: in wrapped
for res in _func(node, context, **kwargs):
astroid/nodes/node_classes.py:3724: in _infer_subscript
for value in self.value.infer(context):
astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):


args = (<Attribute.ByteString l.3 at 0x7f75c592dbd0>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c59adae0>}
generator = <generator object Attribute._infer at 0x7f75c591cbf0>

def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
    generator = func(*args, **kwargs)
    try:
        yield next(generator)
    except StopIteration as error:
        # generator is empty
        if error.args:
            raise InferenceError(**error.args[0]) from error
      raise InferenceError(
            "StopIteration raised without any error information."
        ) from error

E astroid.exceptions.InferenceError: StopIteration raised without any error information.

astroid/decorators.py:91: InferenceError
______________ TypingBrain.test_typing_object_notsubscriptable_3 _______________

args = (<Attribute.ByteString l.3 at 0x7f75c586d630>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c6386260>}
generator = <generator object Attribute._infer at 0x7f75c509d030>

def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
    generator = func(*args, **kwargs)
    try:
      yield next(generator)

E StopIteration

astroid/decorators.py:86: StopIteration

The above exception was the direct cause of the following exception:

self = <tests.brain.test_brain.TypingBrain testMethod=test_typing_object_notsubscriptable_3>

def test_typing_object_notsubscriptable_3(self):
    """Until python39 ByteString class of the typing module is not
    subscriptable (whereas it is in the collections' module)"""
    right_node = builder.extract_node(
        """
    import typing
    typing.ByteString
    """
    )
  inferred = next(right_node.infer())

tests/brain/test_brain.py:914:


astroid/nodes/node_ng.py:168: in infer
for i, result in enumerate(self._infer(context=context, **kwargs)):


args = (<Attribute.ByteString l.3 at 0x7f75c586d630>,)
kwargs = {'context': <astroid.context.InferenceContext object at 0x7f75c6386260>}
generator = <generator object Attribute._infer at 0x7f75c509d030>

def inner(*args: _P.args, **kwargs: _P.kwargs) -> Generator[InferenceResult]:
    generator = func(*args, **kwargs)
    try:
        yield next(generator)
    except StopIteration as error:
        # generator is empty
        if error.args:
            raise InferenceError(**error.args[0]) from error
      raise InferenceError(
            "StopIteration raised without any error information."
        ) from error

E astroid.exceptions.InferenceError: StopIteration raised without any error information.

astroid/decorators.py:91: InferenceError
=========================== short test summary info ============================
FAILED tests/brain/test_brain.py::CollectionsBrain::test_collections_object_subscriptable_3
FAILED tests/brain/test_brain.py::TypingBrain::test_typing_object_notsubscriptable_3
==== 2 failed, 1601 passed, 78 skipped, 7 deselected, 15 xfailed in 41.07s =====

@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue. We're not testing on alphas because the code is not stable enough and we lost time because of it in the past. When the github action permits to use 3.14-dev and it's a beta we're going to check it (right now it's the second alpha as far as I remember).

@Pierre-Sassoulas Pierre-Sassoulas added Bug 🪳 Blocked 🚧 A PR or issue blocked by another PR or issue labels Nov 21, 2024
@limburgher
Copy link
Contributor Author

Perfect, thank you!

@befeleme
Copy link

In the What's new in Python 3.14 document we can see that ByteString was removed from both typing and collections.abc. I believe that's the core reason behind the test failures.

https://docs.python.org/dev/whatsnew/3.14.html#typing
https://docs.python.org/dev/whatsnew/3.14.html#collections-abc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocked 🚧 A PR or issue blocked by another PR or issue Bug 🪳 python 3.14
Projects
None yet
Development

No branches or pull requests

3 participants