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

Under pytest 8.2.0, 'AsyncHTTPTestCase' has no attribute 'runTest' #3375

Closed
sirosen opened this issue Apr 30, 2024 · 1 comment · Fixed by #3382
Closed

Under pytest 8.2.0, 'AsyncHTTPTestCase' has no attribute 'runTest' #3375

sirosen opened this issue Apr 30, 2024 · 1 comment · Fixed by #3382

Comments

@sirosen
Copy link

sirosen commented Apr 30, 2024

I'm one of the maintainers of webargs (https://github.com/marshmallow-code/webargs), and we've had some CI failures start cropping up in the last couple of days related to our tornado support tests. When I start looking in detail, I see that tornado hasn't released in the very recent past, but pytest has, and that the issue appears to be tied to pytest's recent 8.2.0 release.

I have some more detail, in the webargs context, written up over here: marshmallow-code/webargs#941
All I really have so far is that test collection fails with this trace:

____________________ 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'

and that downgrading pytest to 8.1.2 fixes it.

Apologies if this turns out to be a problem with my usage, or a pytest issue (rather than a tornado one), but I wanted to raise it here for visibility.

@sirosen
Copy link
Author

sirosen commented Apr 30, 2024

I think this would be closed by #3374 -- I've just been putting the pieces together from my end.

bdarnell added a commit to bdarnell/tornado that referenced this issue Jun 3, 2024
Overriding _callTestMethod (which was introduced in python 3.8) is a
less hacky way to detect tests that fail to use ``@gen_test`` where
needed. It's not documented, but since Python 3.11 has introduced a
similar check to the standard library we'll be able to remove it in the
near future.

The major impetus for this change is an incompatibility with
Pytest 8.2, which has made a change that tries to instantiate test
classes at discovery time without an existing method name.

Fixes tornadoweb#3375
Closes tornadoweb#3374
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

Successfully merging a pull request may close this issue.

1 participant