Skip to content

Commit b225c08

Browse files
authored
gh-104992: Remove deprecated unittest.TestProgram.usageExit (#104993)
1 parent 897e716 commit b225c08

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Doc/whatsnew/3.13.rst

+5
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,16 @@ Removed
256256
or `python-magic <https://pypi.org/project/python-magic/>`_ instead.
257257
(Contributed by Victor Stinner in :gh:`104773`.)
258258

259+
* Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
260+
method, deprecated in Python 3.11.
261+
(Contributed by Hugo van Kemenade in :gh:`104992`.)
262+
259263
* Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The
260264
third-party Tix library which the module wrapped is unmaintained.
261265
(Contributed by Zachary Ware in :gh:`75552`.)
262266

263267

268+
264269
Porting to Python 3.13
265270
======================
266271

Lib/unittest/main.py

-10
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,6 @@ def __init__(self, module='__main__', defaultTest=None, argv=None,
104104
self.parseArgs(argv)
105105
self.runTests()
106106

107-
def usageExit(self, msg=None):
108-
warnings.warn("TestProgram.usageExit() is deprecated and will be"
109-
" removed in Python 3.13", DeprecationWarning)
110-
if msg:
111-
print(msg)
112-
if self._discovery_parser is None:
113-
self._initArgParsers()
114-
self._print_help()
115-
sys.exit(2)
116-
117107
def _print_help(self, *args, **kwargs):
118108
if self.module is None:
119109
print(self._main_parser.format_help())

Misc/NEWS.d/3.11.0a7.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ Add optional parameter *dir_fd* in :func:`shutil.rmtree`.
10381038
.. nonce: AixHW7
10391039
.. section: Library
10401040
1041-
:meth:`~unittest.TestProgram.usageExit` is marked deprecated, to be removed
1041+
:meth:`~!unittest.TestProgram.usageExit` is marked deprecated, to be removed
10421042
in 3.13.
10431043

10441044
..
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit`
2+
method, deprecated in Python 3.11. Patch by Hugo van Kemenade.

0 commit comments

Comments
 (0)