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

Pytest-describe crashing with yarl.URL #47

Open
Null665 opened this issue Jul 10, 2024 · 0 comments
Open

Pytest-describe crashing with yarl.URL #47

Null665 opened this issue Jul 10, 2024 · 0 comments

Comments

@Null665
Copy link

Null665 commented Jul 10, 2024

Hi, during Python version upgrade I've found a case where pytest-describe crashes when yarl.URL object is initialized under describe_ block.

test.py

import yarl

def describe_case():
    url = yarl.URL("url")

    def test_it():
        pass

requirementa.txt

pytest==8.2.2
pytest-describe==2.2.0
yarl==1.9.4

Output:

$ pytest test.py
================================================= test session starts =================================================
platform linux -- Python 3.11.7, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/as/dev/nonproject/pytest-yarl-case
plugins: describe-2.2.0
collected 0 items / 1 error                                                                                           

======================================================= ERRORS ========================================================
______________________________________________ ERROR collecting test.py _______________________________________________
test.py:4: in describe_case
    url = yarl.URL("url")
.venv/lib/python3.11/site-packages/yarl/_url.py:200: in __new__
    path = cls._PATH_REQUOTER(val[2])
yarl/_quoting_c.pyx:204: in yarl._quoting_c._Quoter.__call__
    ???
.venv/lib/python3.11/site-packages/pytest_describe/plugin.py:18: in _trace_func
    if (frame.f_back.f_locals.get('_trace_func') == _trace_func
E   AttributeError: 'NoneType' object has no attribute 'f_locals'
=============================================== short test summary info ===============================================
ERROR test.py::describe_case - AttributeError: 'NoneType' object has no attribute 'f_locals'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================== 1 error in 0.12s ===================================================


This appears to happen since Python 3.11.
In a bigger test suite this ended up with segmentation fault, but I haven't been able to find minimal example.

My current workaround is to move the variables under fixtures or into test functions, which IMO should have been done from the start.

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

No branches or pull requests

1 participant