diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2023-05-24 21:16:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 21:16:43 (GMT) |
commit | b1cb30ec8639e4e65f62e8f6cd44e979640431c8 (patch) | |
tree | cf12e2acfe17765b9bffe67515fb98b37f46613f /Lib/unittest | |
parent | ded5f1f287674ad404ddd042745433388dc073a5 (diff) | |
download | cpython-b1cb30ec8639e4e65f62e8f6cd44e979640431c8.zip cpython-b1cb30ec8639e4e65f62e8f6cd44e979640431c8.tar.gz cpython-b1cb30ec8639e4e65f62e8f6cd44e979640431c8.tar.bz2 |
gh-104835: Remove unittest's deprecated getTestCaseNames, makeSuite, findTestCases (#104836)
Diffstat (limited to 'Lib/unittest')
-rw-r--r-- | Lib/unittest/__init__.py | 5 | ||||
-rw-r--r-- | Lib/unittest/loader.py | 44 |
2 files changed, 0 insertions, 49 deletions
diff --git a/Lib/unittest/__init__.py b/Lib/unittest/__init__.py index 5bcbf83..f1f6c91 100644 --- a/Lib/unittest/__init__.py +++ b/Lib/unittest/__init__.py @@ -51,10 +51,6 @@ __all__ = ['TestResult', 'TestCase', 'IsolatedAsyncioTestCase', 'TestSuite', 'registerResult', 'removeResult', 'removeHandler', 'addModuleCleanup', 'doModuleCleanups', 'enterModuleContext'] -# Expose obsolete functions for backwards compatibility -# bpo-5846: Deprecated in Python 3.11, scheduled for removal in Python 3.13. -__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) - __unittest = True from .result import TestResult @@ -67,7 +63,6 @@ from .main import TestProgram, main from .runner import TextTestRunner, TextTestResult from .signals import installHandler, registerResult, removeResult, removeHandler # IsolatedAsyncioTestCase will be imported lazily. -from .loader import makeSuite, getTestCaseNames, findTestCases # Lazy import of IsolatedAsyncioTestCase from .async_case diff --git a/Lib/unittest/loader.py b/Lib/unittest/loader.py index b989284..678d627 100644 --- a/Lib/unittest/loader.py +++ b/Lib/unittest/loader.py @@ -437,47 +437,3 @@ class TestLoader(object): defaultTestLoader = TestLoader() - - -# These functions are considered obsolete for long time. -# They will be removed in Python 3.13. - -def _makeLoader(prefix, sortUsing, suiteClass=None, testNamePatterns=None): - loader = TestLoader() - loader.sortTestMethodsUsing = sortUsing - loader.testMethodPrefix = prefix - loader.testNamePatterns = testNamePatterns - if suiteClass: - loader.suiteClass = suiteClass - return loader - -def getTestCaseNames(testCaseClass, prefix, sortUsing=util.three_way_cmp, testNamePatterns=None): - import warnings - warnings.warn( - "unittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. " - "Please use unittest.TestLoader.getTestCaseNames() instead.", - DeprecationWarning, stacklevel=2 - ) - return _makeLoader(prefix, sortUsing, testNamePatterns=testNamePatterns).getTestCaseNames(testCaseClass) - -def makeSuite(testCaseClass, prefix='test', sortUsing=util.three_way_cmp, - suiteClass=suite.TestSuite): - import warnings - warnings.warn( - "unittest.makeSuite() is deprecated and will be removed in Python 3.13. " - "Please use unittest.TestLoader.loadTestsFromTestCase() instead.", - DeprecationWarning, stacklevel=2 - ) - return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase( - testCaseClass) - -def findTestCases(module, prefix='test', sortUsing=util.three_way_cmp, - suiteClass=suite.TestSuite): - import warnings - warnings.warn( - "unittest.findTestCases() is deprecated and will be removed in Python 3.13. " - "Please use unittest.TestLoader.loadTestsFromModule() instead.", - DeprecationWarning, stacklevel=2 - ) - return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(\ - module) |