Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
bpo-5846: Deprecate obsolete methods makeSuite, findTestCases, and getTestCaseNames in unittest#20400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
bpo-5846: Deprecate obsolete methods makeSuite, findTestCases, and getTestCaseNames in unittest #20400
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -365,6 +365,10 @@ Deprecated | ||
| scheduled for removal in Python 3.12. | ||
| (Contributed by Erlend E. Aasland in :issue:`42264`.) | ||
| * :meth:`unittest.makeSuite`, :meth:`unittest.findTestCases`, and :meth:`unittest.getTestCaseNames` | ||
erlend-aasland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| are now deprecated, scheduled for removal in Python 3.12. | ||
| (Contributed by Erlend E. Aasland in :issue:`5846`.) | ||
| Removed | ||
| ======= | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1077,7 +1077,7 @@ def run_unittest(*classes): | ||
| elif isinstance(cls, valid_types): | ||
| suite.addTest(cls) | ||
| else: | ||
| suite.addTest(unittest.makeSuite(cls)) | ||
| suite.addTest(unittest.TestLoader().loadTestsFromTestCase(cls)) | ||
erlend-aasland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| _filter_suite(suite, match_test) | ||
| _run_suite(suite) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -503,15 +503,31 @@ def _makeLoader(prefix, sortUsing, suiteClass=None, testNamePatterns=None): | ||
| loader.suiteClass = suiteClass | ||
| return loader | ||
| # Issue 5846: getTestCaseNames, makeSuite, and findTestCases are deprecated as | ||
erlend-aasland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| # of Python 3.10, scheduled for removal in Python 3.12. | ||
| def getTestCaseNames(testCaseClass, prefix, sortUsing=util.three_way_cmp, testNamePatterns=None): | ||
| warnings.warn( | ||
| "getTestCaseNames() is deprecated and will be removed in Python 3.12.", | ||
erlend-aasland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| DeprecationWarning, stacklevel=2 | ||
| ) | ||
| return _makeLoader(prefix, sortUsing, testNamePatterns=testNamePatterns).getTestCaseNames(testCaseClass) | ||
| def makeSuite(testCaseClass, prefix='test', sortUsing=util.three_way_cmp, | ||
| suiteClass=suite.TestSuite): | ||
| warnings.warn( | ||
| "makeSuite() is deprecated and will be removed in Python 3.12. " | ||
| "Please use loadTestsFromTestCase() instead.", | ||
erlend-aasland marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| DeprecationWarning, stacklevel=2 | ||
| ) | ||
| return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase( | ||
| testCaseClass) | ||
| def findTestCases(module, prefix='test', sortUsing=util.three_way_cmp, | ||
| suiteClass=suite.TestSuite): | ||
| warnings.warn( | ||
| "findTestCases() is deprecated and will be removed in Python 3.12. " | ||
| "Please use loadTestsFromModule() instead.", | ||
| DeprecationWarning, stacklevel=2 | ||
| ) | ||
| return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(\ | ||
| module) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| :meth:`unittest.findTestCases`, :meth:`unittest.makeSuite`, and | ||
| :meth:`unittest.getTestCaseNames` are now deprecated, scheduled for removal in | ||
| Python 3.12. | ||
| Patch by Erlend E. Aasland. |
Uh oh!
There was an error while loading. Please reload this page.