]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104992: Remove deprecated unittest.TestProgram.usageExit (#104993)
authorHugo van Kemenade <hugovk@users.noreply.github.com>
Sat, 27 May 2023 21:34:14 +0000 (00:34 +0300)
committerGitHub <noreply@github.com>
Sat, 27 May 2023 21:34:14 +0000 (21:34 +0000)
Doc/whatsnew/3.13.rst
Lib/unittest/main.py
Misc/NEWS.d/3.11.0a7.rst
Misc/NEWS.d/next/Library/2023-05-26-21-33-24.gh-issue-104992.dbq9WK.rst [new file with mode: 0644]

index a47a03731338b82a07f394d6e5185d546a899194..45728d1801d20a294a46daa6ca0199ca9f84a0ae 100644 (file)
@@ -256,11 +256,16 @@ Removed
   or `python-magic <https://pypi.org/project/python-magic/>`_ instead.
   (Contributed by Victor Stinner in :gh:`104773`.)
 
+* Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
+  method, deprecated in Python 3.11.
+  (Contributed by Hugo van Kemenade in :gh:`104992`.)
+
 * Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6.  The
   third-party Tix library which the module wrapped is unmaintained.
   (Contributed by Zachary Ware in :gh:`75552`.)
 
 
+
 Porting to Python 3.13
 ======================
 
index 51b81a6c3728bbf35d0ddf47faec93ce63fd55e5..03963e0b1b2a046c1f5d1f488ac554fd4f6d0ddf 100644 (file)
@@ -104,16 +104,6 @@ class TestProgram(object):
         self.parseArgs(argv)
         self.runTests()
 
-    def usageExit(self, msg=None):
-        warnings.warn("TestProgram.usageExit() is deprecated and will be"
-                      " removed in Python 3.13", DeprecationWarning)
-        if msg:
-            print(msg)
-        if self._discovery_parser is None:
-            self._initArgParsers()
-        self._print_help()
-        sys.exit(2)
-
     def _print_help(self, *args, **kwargs):
         if self.module is None:
             print(self._main_parser.format_help())
index 5e9aadf63956596322c2b61c7a286ae9d3574e0b..d3e59a2195669f8534f56c660fceb8e1fd880a14 100644 (file)
@@ -1038,7 +1038,7 @@ Add optional parameter *dir_fd* in :func:`shutil.rmtree`.
 .. nonce: AixHW7
 .. section: Library
 
-:meth:`~unittest.TestProgram.usageExit` is marked deprecated, to be removed
+:meth:`~!unittest.TestProgram.usageExit` is marked deprecated, to be removed
 in 3.13.
 
 ..
diff --git a/Misc/NEWS.d/next/Library/2023-05-26-21-33-24.gh-issue-104992.dbq9WK.rst b/Misc/NEWS.d/next/Library/2023-05-26-21-33-24.gh-issue-104992.dbq9WK.rst
new file mode 100644 (file)
index 0000000..d72646a
--- /dev/null
@@ -0,0 +1,2 @@
+Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
+method, deprecated in Python 3.11. Patch by Hugo van Kemenade.