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

astroid crashes with RecursionError in a pytest session if schemathesis is installed #2427

Open
jherbel opened this issue May 10, 2024 · 5 comments

Comments

@jherbel
Copy link

jherbel commented May 10, 2024

Steps to reproduce

Run pytest on the following file:

import astroid

def test_something() -> None:
    astroid.parse("123")

Result without schemathesis:

$ pytest /home/joerg/tmp/test_with_astroid.py 
=================================== test session starts ===================================
platform linux -- Python 3.12.3, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/joerg
plugins: anyio-4.3.0, hypothesis-6.100.6, subtests-0.7.0
collected 1 item                                                                          

tmp/test_with_astroid.py .                                                          [100%]

==================================== 1 passed in 0.28s ====================================

Result with schemathesis:

$ pytest /home/joerg/tmp/test_with_astroid.py 
=================================== test session starts ===================================
platform linux -- Python 3.12.3, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/joerg
plugins: anyio-4.3.0, hypothesis-6.100.6, schemathesis-3.27.1, subtests-0.7.0
collected 1 item                                                                          

tmp/test_with_astroid.py F                                                          [100%]

======================================== FAILURES =========================================
_____________________________________ test_something ______________________________________

    def test_something() -> None:
>   	astroid.parse("123")

tmp/test_with_astroid.py:4: 
...
self = <Const l.0 at 0x7fe6c1531e20>, proxied = None

    def __init__(self, proxied: nodes.ClassDef | None) -> None:
>       super().__init__(proxied)
E       RecursionError: maximum recursion depth exceeded

.pyenv/versions/3.12.3/lib/python3.12/site-packages/astroid/bases.py:342: RecursionError
==================================== warnings summary =====================================
tmp/test_with_astroid.py::test_something
  /home/joerg/.pyenv/versions/3.12.3/lib/python3.12/site-packages/_pytest/python.py:1772: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
  Plugin: schemathesis, Hook: pytest_pyfunc_call
  RecursionError: maximum recursion depth exceeded
  For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================= short test summary info =================================
FAILED tmp/test_with_astroid.py::test_something - RecursionError: maximum recursion depth exceeded
============================== 1 failed, 1 warning in 15.09s ==============================

Current behavior

When using astroid in pytest session with schemathesis installed, I get a RecursionError. Without schemathesis, I don't.

Expected behavior

astroid works in a pytest session if schemathesis is installed.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

3.2.0

I also opened an issue with schemathesis: schemathesis/schemathesis#2170

@jacobtylerwalls
Copy link
Member

Hi @jherbel, thanks for the report. It's possible this was just fixed on main. We'll release a patch release shortly. Would you be able to retest either then (or now, with bleeding edge)? Thanks!

@jacobtylerwalls jacobtylerwalls added this to the 3.2.1 milestone May 16, 2024
@jacobtylerwalls
Copy link
Member

Oh I see from the linked issue this may be #2191 instead.

@jacobtylerwalls jacobtylerwalls removed this from the 3.2.1 milestone May 16, 2024
@jherbel
Copy link
Author

jherbel commented May 16, 2024

So should I test anything atm?

@jacobtylerwalls
Copy link
Member

If you can retest with pylint 3.2.2 (which installs astroid 3.2.2) that would be a helpful data point, thanks.

@jherbel
Copy link
Author

jherbel commented May 21, 2024

Still the same crash with astroid 3.2.2.

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

3 participants