Skip to content

gh-89325: Revert "bpo-45162: Revert "Remove many old deprecated unittest features" (GH-30935)" #92557

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/unittest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,7 @@ Loading and running tests
.. versionchanged:: 3.5
Support for a keyword-only argument *pattern* has been added.

.. versionchanged:: 3.11
.. versionchanged:: 3.12
The undocumented and unofficial *use_load_tests* parameter has been
removed.

Expand Down
21 changes: 21 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,27 @@ Deprecated
Removed
=======

* Removed many old deprecated :mod:`unittest` features:

- :class:`~unittest.TestCase` method aliases ``failUnlessEqual``,
``failIfEqual``, ``failUnless``, ``failIf``, ``failUnlessRaises``,
``failUnlessAlmostEqual``, ``failIfAlmostEqual`` (deprecated in Python 3.1),
``assertEquals``, ``assertNotEquals``, ``assert_``, ``assertAlmostEquals``,
``assertNotAlmostEquals``, ``assertRegexpMatches``, ``assertRaisesRegexp``
(deprecated in Python 3.2), and ``assertNotRegexpMatches`` (deprecated in
Python 3.5).

- Undocumented and broken :class:`~unittest.TestCase` method
``assertDictContainsSubset`` (deprecated in Python 3.2).

- Undocumented :meth:`<unittest.TestLoader.loadTestsFromModule>
TestLoader.loadTestsFromModule` parameter *use_load_tests* (deprecated
and ignored since Python 3.2).

- An alias of the :class:`~unittest.TextTestResult` class:
``_TextTestResult`` (deprecated in Python 3.2).

(Contributed by Serhiy Storchaka in :issue:`89325`.)


Porting to Python 3.12
Expand Down
2 changes: 1 addition & 1 deletion Lib/unittest/test/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,7 @@ def testAssertNoLogsYieldsNone(self):
self.assertIsNone(value)

def testDeprecatedFailMethods(self):
"""Test that the deprecated fail* methods get removed in 3.11"""
"""Test that the deprecated fail* methods get removed in 3.12"""
deprecated_names = [
'failIfEqual', 'failUnlessEqual', 'failUnlessAlmostEqual',
'failIfAlmostEqual', 'failUnless', 'failUnlessRaises', 'failIf',
Expand Down
2 changes: 1 addition & 1 deletion Lib/unittest/test/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def load_tests(loader, tests, pattern):
self.assertIsInstance(suite, unittest.TestSuite)
self.assertEqual(load_tests_args, [loader, suite, None])

# In Python 3.11, the undocumented and unofficial use_load_tests has
# In Python 3.12, the undocumented and unofficial use_load_tests has
# been removed.
with self.assertRaises(TypeError):
loader.loadTestsFromModule(m, False)
Expand Down