[Python-checkins] bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293)
JelleZijlstra
webhook-mailer at python.org
Wed Mar 16 22:41:26 EDT 2022
https://github.com/python/cpython/commit/7c353b7594545fb9403b3123a17ad06cadc2f73d
commit: 7c353b7594545fb9403b3123a17ad06cadc2f73d
branch: main
author: Carlos Damazio <carlos.damazio at damazio.dev>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2022-03-16T19:41:02-07:00
summary:
bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>
files:
A Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst
M Lib/unittest/main.py
diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py
index e62469aa2a170..cb8f1f302801d 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
@@ -101,6 +102,8 @@ def __init__(self, module='__main__', defaultTest=None, argv=None,
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:
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 0000000000000..f6380b0f904e8
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-12-29-19-37-49.bpo-22859.AixHW7.rst
@@ -0,0 +1 @@
+:meth:`~unittest.TestProgram.usageExit` is marked deprecated, to be removed in 3.13.
More information about the Python-checkins
mailing list