From 6dc93caec8d4f065bd640bc18bba74a4f8c0e58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Dam=C3=A1zio?= Date: Wed, 29 Dec 2021 16:33:30 -0300 Subject: [PATCH 1/5] bpo-22859: deprecating unittest.TestProgram.usageExit --- Lib/unittest/main.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py index e62469aa2a170f..4467b6a5ad4150 100644 --- a/Lib/unittest/main.py +++ b/Lib/unittest/main.py @@ -100,14 +100,6 @@ def __init__(self, module='__main__', defaultTest=None, argv=None, self.parseArgs(argv) self.runTests() - def usageExit(self, msg=None): - 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()) From 797aeafde0c49a6934a2b4bbfaa2065dd891ffd7 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 29 Dec 2021 19:37:50 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst diff --git a/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst new file mode 100644 index 00000000000000..be5e56e4ef96eb --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst @@ -0,0 +1 @@ +`unittest.TestProgram.usageExit` is no longer accessible. \ No newline at end of file From 70b6ddf473d1d0f2a042018586592b61789d2443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Dam=C3=A1zio?= Date: Sat, 29 Jan 2022 09:49:34 -0300 Subject: [PATCH 3/5] fix: mark as being deprecated instead --- Lib/unittest/main.py | 11 +++++++++++ .../Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py index 4467b6a5ad4150..36b529c17f3510 100644 --- a/Lib/unittest/main.py +++ b/Lib/unittest/main.py @@ -3,6 +3,7 @@ import sys import argparse import os +import warnings from . import loader, runner from .signals import installHandler @@ -100,6 +101,16 @@ def __init__(self, module='__main__', defaultTest=None, argv=None, self.parseArgs(argv) self.runTests() + def usageExit(self, msg=None): + warnings.warn("function \"usageExit\" is being deprecated and will be" + " removed in 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()) diff --git a/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst index be5e56e4ef96eb..50ae3b1baff516 100644 --- a/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst +++ b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst @@ -1 +1 @@ -`unittest.TestProgram.usageExit` is no longer accessible. \ No newline at end of file +`unittest.TestProgram.usageExit` is marked deprecated, to be removed in 3.13. From 98241d46732da96dd29ac3f4dc23acc1bb4011f2 Mon Sep 17 00:00:00 2001 From: Carlos Damazio Date: Sat, 29 Jan 2022 10:27:52 -0300 Subject: [PATCH 4/5] Update Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> --- .../next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst index 50ae3b1baff516..f6380b0f904e88 100644 --- a/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst +++ b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst @@ -1 +1 @@ -`unittest.TestProgram.usageExit` is marked deprecated, to be removed in 3.13. +:meth:`~unittest.TestProgram.usageExit` is marked deprecated, to be removed in 3.13. From e0914f8f1e084b81a82f4d8c21aa00442168f371 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 16 Feb 2022 19:24:31 -0800 Subject: [PATCH 5/5] Update Lib/unittest/main.py --- Lib/unittest/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py index 36b529c17f3510..cb8f1f302801dc 100644 --- a/Lib/unittest/main.py +++ b/Lib/unittest/main.py @@ -102,8 +102,8 @@ def __init__(self, module='__main__', defaultTest=None, argv=None, self.runTests() def usageExit(self, msg=None): - warnings.warn("function \"usageExit\" is being deprecated and will be" - " removed in 3.13", DeprecationWarning) + 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: