-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Issue with pytest 8.2.0 and tornado async tests #12263
Comments
Thanks the report, I will look into it. |
My preference would be to fix Tornado, I will try to submit a patch. Otherwise will fix in pytest somehow. |
`unittest.TestCase` has a feature where it allows instantiating `MyTestClass()` with the default method name `runTest` even if a `runTest` method doesn't actually exist. This is documented in `TestCase`'s docs under "Changed in version 3.2"[0]. Since version 8.2, pytest relies on this, and started breaking on Tornado's `AsyncTestCase`[1]. Change `AsyncTestCase` to allow empty instatiation, by matching the upstream code. [0] https://docs.python.org/3/library/unittest.html#unittest.TestCase [1] pytest-dev/pytest#12263
## Describe your changes - Looks like pytest 8.2 breaks with tornado - As a result, we should likely pin 8.1 pytest - pytest-dev/pytest#12263 ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
This comment was marked as outdated.
This comment was marked as outdated.
## Describe your changes - Looks like pytest 8.2 breaks with tornado - As a result, we should likely pin 8.1 pytest - pytest-dev/pytest#12263 ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
Fixes community/py3-stestr tests ref: pytest-dev/pytest#12263 (comment) ref: mtreinish/stestr#363
pytest 82. relies on a feature of `unittest.TestCase` where the initialization of it with the default `methodName="runTest"` is treated specially, allowing it to insantiate even without `runTest` method actually existing. See under "Changed in Python 3.2" in unittest.TestCase docs This fixes the error with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? Fixes: testing-cabal#372 ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 ref: pytest-dev/pytest#12263 (comment)
pytest 8.2 relies on a feature of `unittest.TestCase` where the initialization of it with the default `methodName="runTest"` is treated specially, allowing it to insantiate even without `runTest` method actually existing. See under "Changed in Python 3.2" in unittest.TestCase docs This fixes the error with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? Fixes: testing-cabal#372 ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 ref: pytest-dev/pytest#12263 (comment)
Some projects (like mine) use a common base class BaseTestCase(AsyncTestCase):
# Workaround for https://github.com/pytest-dev/pytest/issues/12263.
def runTest(self): pass Another workaround, more intrusive but I think harmless and easier, is to drop the following in a from tornado.testing import AsyncTestCase
# Workaround for https://github.com/pytest-dev/pytest/issues/12263.
AsyncTestCase.runTest = lambda self: ... |
pytest 8.2 relies on a feature of `unittest.TestCase` where the initialization of it with the default `methodName="runTest"` is treated specially, allowing it to insantiate even without `runTest` method actually existing. See under "Changed in Python 3.2" in unittest.TestCase docs This fixes the error with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? Fixes: testing-cabal#372 ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 ref: pytest-dev/pytest#12263 (comment)
pytest 8.2 relies on a feature of `unittest.TestCase` where the initialization of it with the default `methodName="runTest"` is treated specially, allowing it to insantiate even without `runTest` method actually existing. See under "Changed in Python 3.2" in unittest.TestCase docs This fixes the error with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? Fixes: testing-cabal#372 ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 ref: pytest-dev/pytest#12263 (comment)
pytest 8.2 relies on a feature of `unittest.TestCase` where the initialization of it with the default `methodName="runTest"` is treated specially, allowing it to insantiate even without `runTest` method actually existing. See under "Changed in Python 3.2" in unittest.TestCase docs This fixes the error with pytest 8.2: AttributeError: 'TestUtil' object has no attribute 'runTest'. Did you mean: 'subTest'? Fixes: testing-cabal#372 ref: https://docs.python.org/3/library/unittest.html#unittest.TestCase ref: https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426 ref: pytest-dev/pytest#12263 (comment)
This is fixed in Tornado 6.4.1: https://www.tornadoweb.org/en/stable/releases/v6.4.1.html |
This is due to a but in pytest. See pytest-dev/pytest#12263
This is due to a but in pytest. See pytest-dev/pytest#12263
This is due to a but in pytest. See pytest-dev/pytest#12263
This is due to a but in pytest. See pytest-dev/pytest#12263
This is due to a but in pytest. See pytest-dev/pytest#12263
* Enable building and testing for python 3.10 to 3.12. * The imp module is deprecated in 3.12. * The version is moved into a designated module that can be imported by setup.py without importing the whole module. * Make use of the extends syntax in gitlab-ci. * Restrict pytest < 8.2 because of issues with async tests. (pytest-dev/pytest#12263) * Replace deprecated unittest assertEquals with assertEqual.
## Describe your changes - Looks like pytest 8.2 breaks with tornado - As a result, we should likely pin 8.1 pytest - pytest-dev/pytest#12263 ## GitHub Issue Link (if applicable) ## Testing Plan - Explanation of why no additional tests are needed - Unit Tests (JS and/or Python) - E2E Tests - Any manual testing needed? --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.
I'm using the AsyncHTTPTestCase and AsyncHTTPSTestCase from tornado and the latest pytest fails in collection on this error:
The issue does not exists in 8.1.0
The text was updated successfully, but these errors were encountered: