Skip to content

Commit

Permalink
pythongh-104992: Remove deprecated unittest.TestProgram.usageExit (py…
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored May 27, 2023
1 parent 897e716 commit b225c08
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======================

Expand Down
10 changes: 0 additions & 10 deletions Lib/unittest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ def __init__(self, module='__main__', defaultTest=None, argv=None,
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())
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.11.0a7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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

0 comments on commit b225c08

Please sign in to comment.