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

Testsuite fails under pytest==8.2.0 with 'AsyncHTTPTestCase' has no attribute 'runTest' #941

Closed
sirosen opened this issue Apr 30, 2024 · 2 comments

Comments

@sirosen
Copy link
Collaborator

sirosen commented Apr 30, 2024

We currently have some test failures in basically all python versions, starting ~2 days ago. At first glance, it looks like an issue with tornado's AsyncHTTPTestCase, but tornado doesn't have a recent release.

Looking at what projects updated recently, I flagged pytest as a good candidate for investigation, and testing with pytest=8.1.2 works fine. So something related to unittest TestCases changed in 8.2.0 in a way that breaks tornado tests.

For reference, here's one of the error traces:

____________________ ERROR collecting tests/test_tornadoparser.py ____________________
.tox/py311/lib/python3.11/site-packages/tornado/testing.py:180: in __init__
    setattr(self, methodName, _TestMethodWrapper(getattr(self, methodName)))
E   AttributeError: 'AsyncHTTPTestCase' object has no attribute 'runTest'
____________________ ERROR collecting tests/test_tornadoparser.py ____________________
.tox/py311/lib/python3.11/site-packages/tornado/testing.py:180: in __init__
    setattr(self, methodName, _TestMethodWrapper(getattr(self, methodName)))
E   AttributeError: 'TestApp' object has no attribute 'runTest'
____________________ ERROR collecting tests/test_tornadoparser.py ____________________
.tox/py311/lib/python3.11/site-packages/tornado/testing.py:180: in __init__
    setattr(self, methodName, _TestMethodWrapper(getattr(self, methodName)))
E   AttributeError: 'TestValidateApp' object has no attribute 'runTest'

runTest looks like a dynamically created method in unittest, whose name gets passed on init to TestCase.
I started looking at changes to pytest's unittest module ( https://github.com/pytest-dev/pytest/blame/main/src/_pytest/unittest.py ), but I'm out of time for digging into this right now.

@sirosen
Copy link
Collaborator Author

sirosen commented Apr 30, 2024

I reported this to one of the relevant upstreams (tornado) and then started looking at reporting to pytest. I see that there's a thread over there about this: pytest-dev/pytest#12263

And that the pytest devs want to submit a patch to tornado. I haven't really followed the details on this one that well, so no opinion yet. But let's wait on this to see if there's a fix.

If tornado gets patched, it may have strange implications for our minimal version testing. We might have to pin down pytest for that as well.

@lafrech
Copy link
Member

lafrech commented Apr 30, 2024

Thanks for investigating. I saw the failures but didn't have the time to look into it yet.

Good to know it is being taken care of upstream.

sirosen added a commit to sirosen/webargs that referenced this issue May 17, 2024
This is a workaround which resolves marshmallow-code#941 for now.
@sloria sloria closed this as completed in 9b3cd2f May 21, 2024
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

2 participants