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

[BUG] Cannot import Astroid with schemathesis 3.19.6. #1745

Closed
2 tasks done
kain88-de opened this issue May 29, 2023 · 2 comments
Closed
2 tasks done

[BUG] Cannot import Astroid with schemathesis 3.19.6. #1745

kain88-de opened this issue May 29, 2023 · 2 comments
Assignees
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior

Comments

@kain88-de
Copy link

kain88-de commented May 29, 2023

Checklist

Describe the bug
When I start a pytest session the astroid package enters an infinite loop when it is imported.

To Reproduce
I prepared a pipenv file that creates an environment to reproduce the issues.

Once you downloaded all files run

  1. make .venv
  2. run-pipenv run python -m pytest t.py --pdb

This will drop you in a debugger session at the place where astroid is stuck in a loop. With version 3.19.0 everything still works.

Expected behavior

Adding schemathesis as a dependency has no impact if I can import astroid in a pytest environment or not.

Environment (please complete the following information):

  • OS: linux
  • Python version: 3.11
  • Schemathesis version: 3.19.6

Additional context
I'm not sure what the root cause is so I will also open tickets for this with pytest and astroid.

@The-Compiler
Copy link

Over in pytest-dev/pytest#11053 (comment), I bisected this to #1736 - apparently, doing something like:

from dataclasses import dataclass

print(type(__builtins__))
print(hasattr(__builtins__, "__builtins__"))

@dataclass
class Bla(Exception):

    __module__ = "builtins"

print(type(__builtins__))
print(hasattr(__builtins__, "__builtins__"))

causes a __builtins__.__builtins__ to appear out of nowhere, and that in turn causes astroid to choke. Why? No idea! But schemathesis seems to be out of the picture, unless you want to avoid this kind of pattern to work around this. But I suppose it should be fixed in astroid.

@Stranger6667
Copy link
Member

I think this should be fixed on the astroid side, going to close this one. Thank you for investigating and providing context!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior
Projects
None yet
Development

No branches or pull requests

3 participants