jd / tenacity

Retrying library for Python
http://tenacity.readthedocs.io
Apache License 2.0
6.82k stars 283 forks source link

`tests/test_tornado.py::TestTornado - AttributeError: 'TestTornado' object has no attribute 'runTest'` w/ pytest-8.2.0 #460

Open mgorny opened 6 months ago

mgorny commented 6 months ago

When trying to run tests, I'm getting the following error:

$ tox -e py311
py311: install_deps> python -I -m pip install '.[doc]' '.[test]'
.pkg-cpython311: install_requires> python -I -m pip install 'setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0' 'setuptools_scm[toml]>=3.4'
.pkg-cpython311: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython311: get_requires_for_build_editable> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg-cpython311: install_requires_for_build_editable> python -I -m pip install setuptools_scm wheel
.pkg-cpython311: build_editable> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py311: install_package> python -I -m pip install --force-reinstall --no-deps /tmp/tenacity/.tox/.tmp/package/1/tenacity-8.3.0-0.editable-py3-none-any.whl
py311: commands[0]> pytest
========================================================= test session starts =========================================================
platform linux -- Python 3.11.9, pytest-8.2.0, pluggy-1.5.0
cachedir: .tox/py311/.pytest_cache
rootdir: /tmp/tenacity
configfile: setup.cfg
plugins: typeguard-4.2.1
collected 109 items / 1 error                                                                                                         

=============================================================== ERRORS ================================================================
_______________________________________________ ERROR collecting tests/test_tornado.py ________________________________________________
.tox/py311/lib/python3.11/site-packages/tornado/testing.py:180: in __init__
    setattr(self, methodName, _TestMethodWrapper(getattr(self, methodName)))
E   AttributeError: 'TestTornado' object has no attribute 'runTest'
======================================================= short test summary info =======================================================
ERROR tests/test_tornado.py::TestTornado - AttributeError: 'TestTornado' object has no attribute 'runTest'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================== 1 error in 0.27s ===========================================================
py311: exit 2 (0.68 seconds) /tmp/tenacity> pytest pid=22558
  py311: FAIL code 2 (23.57=setup[22.89]+cmd[0.68] seconds)
  evaluation failed :( (29.50 seconds)

This is a regression after upgrading to pytest-8.2.0.

stanislavlevin commented 6 months ago

JFYI: https://github.com/tornadoweb/tornado/issues/3375 https://github.com/tornadoweb/tornado/pull/3374

LilMonk commented 6 months ago

Although its a Tornado issue. I made the test work by adding:

class TestTornado(testing.AsyncTestCase):  # type: ignore[misc]
    ...
    def runTest(self):
        self.subTest()

Just waiting for the fix. :smile:

kloczek commented 6 months ago

Could you please drop the patch for that? đŸ¤”

LilMonk commented 6 months ago

The patch is not expected in tenacity rather it is from tornado's side. Refer:

JFYI: tornadoweb/tornado#3375 tornadoweb/tornado#3374