testing-cabal / testtools

Testtools - tasteful testing for python
https://testtools.readthedocs.io/en/latest/
Other
94 stars 88 forks source link

Treat methodName="runTest" similar to unittest.TestCase #373

Closed ncopa closed 3 months ago

ncopa commented 3 months ago

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: https://github.com/testing-cabal/testtools/issues/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: https://github.com/pytest-dev/pytest/issues/12263#issuecomment-2081434468

ncopa commented 3 months ago

ruff formatted it (I hope). sorry for that.