Skip to content

Commit cbe5996

Browse files
bluetechpytestbot
authored andcommitted
[8.2.x] changelog: document unittest 8.2 change as breaking
1 parent 328001e commit cbe5996

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/en/changelog.rst

+18
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ with advance notice in the **Deprecations** section of releases.
3131
pytest 8.2.0 (2024-04-27)
3232
=========================
3333

34+
Breaking Changes
35+
----------------
36+
37+
- `#12089 <https://github.com/pytest-dev/pytest/pull/12089>`_: pytest now requires that :class:`unittest.TestCase` subclasses can be instantiated freely using ``MyTestCase('runTest')``.
38+
39+
If the class doesn't allow this, you may see an error during collection such as ``AttributeError: 'MyTestCase' object has no attribute 'runTest'``.
40+
41+
Classes which do not override ``__init__``, or do not access the test method in ``__init__`` using ``getattr`` or similar, are unaffected.
42+
43+
Classes which do should take care to not crash when ``"runTest"`` is given, as is shown in `unittest.TestCases's implementation <https://github.com/python/cpython/blob/51aefc5bf907ddffaaf083ded0de773adcdf08c8/Lib/unittest/case.py#L419-L426>`_.
44+
Alternatively, consider using :meth:`setUp <unittest.TestCase.setUp>` instead of ``__init__``.
45+
46+
If you run into this issue using ``tornado.AsyncTestCase``, please see `issue 12263 <https://github.com/pytest-dev/pytest/issues/12263>`_.
47+
48+
If you run into this issue using an abstract ``TestCase`` subclass, please see `issue 12275 <https://github.com/pytest-dev/pytest/issues/12275>`_.
49+
50+
Historical note: the effect of this change on custom TestCase implementations was not properly considered initially, this is why it was done in a minor release. We apologize for the inconvenience.
51+
3452
Deprecations
3553
------------
3654

0 commit comments

Comments
 (0)