bpo-22859: deprecate unittest.main.TestProgram.usageExit (GH-30293) · python/cpython@7c353b7 (original) (raw)

Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
3 3 import sys
4 4 import argparse
5 5 import os
6 +import warnings
6 7
7 8 from . import loader, runner
8 9 from .signals import installHandler
@@ -101,6 +102,8 @@ def __init__(self, module='__main__', defaultTest=None, argv=None,
101 102 self.runTests()
102 103
103 104 def usageExit(self, msg=None):
105 +warnings.warn("TestProgram.usageExit() is deprecated and will be"
106 +" removed in Python 3.13", DeprecationWarning)
104 107 if msg:
105 108 print(msg)
106 109 if self._discovery_parser is None: