From cbe5996cc684b00397494d9590f3179de232c3ee Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 14 May 2024 23:06:48 +0300 Subject: [PATCH] [8.2.x] changelog: document unittest 8.2 change as breaking --- doc/en/changelog.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 2630d95cf28..fb276a93839 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -31,6 +31,24 @@ with advance notice in the **Deprecations** section of releases. pytest 8.2.0 (2024-04-27) ========================= +Breaking Changes +---------------- + +- `#12089 `_: pytest now requires that :class:`unittest.TestCase` subclasses can be instantiated freely using ``MyTestCase('runTest')``. + + If the class doesn't allow this, you may see an error during collection such as ``AttributeError: 'MyTestCase' object has no attribute 'runTest'``. + + Classes which do not override ``__init__``, or do not access the test method in ``__init__`` using ``getattr`` or similar, are unaffected. + + Classes which do should take care to not crash when ``"runTest"`` is given, as is shown in `unittest.TestCases's implementation `_. + Alternatively, consider using :meth:`setUp ` instead of ``__init__``. + + If you run into this issue using ``tornado.AsyncTestCase``, please see `issue 12263 `_. + + If you run into this issue using an abstract ``TestCase`` subclass, please see `issue 12275 `_. + + 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. + Deprecations ------------