Issue 5846: Deprecate obsolete functions in unittest (original) (raw)

Created on 2009-04-25 23:44 by michael.foord, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 20400 closed erlendaasland,2020-05-25 21:56
PR 28299 merged erlendaasland,2021-09-12 21:14
PR 28303 merged serhiy.storchaka,2021-09-13 06:16
PR 28382 merged serhiy.storchaka,2021-09-16 08:27
Messages (13)
msg86574 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-04-25 23:44
_makeLoader, getTestCaseNames, makeSuite and findTestCases have all had the comment "these functions should be considered obsolete" for a long time. Is is ok to go straight to deprecation or should they be marked with PendingDeprecationWarning first?
msg86687 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-27 17:08
I guess adding a standard DeprecationWarning is fine in these cases.
msg87298 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-05 23:00
So it turns out that unittest.makeSuite is used about 100 times throughout the standard library tests. More than half the time it can be replaced with unittest.TestLoader().loadTestsFromTestCase(...) Some of the other times a loader needs to be constructed and then a testMethodPrefix of 'Check' set (yuck!). I'm about halfway through a patch that does this. Think it is worth continuing or shall I drop it. I don't mind doing it so long as *someone* thinks it is worthwhile... :-) (I haven't yet checked for getTestCaseNames but I imagine there will be a bunch of these to fix as well.) Another possibility is to move the functions into test_support (deprecating first) where at least they are out of unittest.
msg87361 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-05-07 08:24
I'm sure Gerhard wouldn't say no to changing the sqlite3 test prefix to "test_"...
msg87592 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2009-05-11 21:48
Hehe - I wasn't actually doing that, just replacing the use of the obsolete functions.
msg386705 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-02-09 10:45
> I'm sure Gerhard wouldn't say no to changing the sqlite3 test prefix to "test_"... FYI, the sqlite3 tests have now been cleaned up (GH-20538). Remaining occurrences in Lib/test: Lib/test/test_pdb.py: unittest.makeSuite(PdbTestCase), Lib/test/test_dbm.py: suites = [unittest.makeSuite(c) for c in classes] Lib/test/test_io.py: suite = unittest.TestSuite([unittest.makeSuite(test) for test in tests]) Lib/test/test_threading_local.py: suite.addTest(unittest.makeSuite(ThreadLocalTest)) Lib/test/test_threading_local.py: suite.addTest(unittest.makeSuite(PyThreadingLocalTest)) Lib/test/test_zipimport.py: # item in a list sorted by name, like unittest.makeSuite() does.) Lib/test/support/__init__.py: suite.addTest(unittest.findTestCases(sys.modules[cls])) Lib/test/support/__init__.py: suite.addTest(unittest.makeSuite(cls)) Lib/test/support/testresult.py: suite.addTest(unittest.makeSuite(TestTests)) Lib/test/test_email/torture_test.py: suite.addTest(unittest.makeSuite(testclass)) Lib/test/test_math.py: suite.addTest(unittest.makeSuite(MathTests)) Lib/test/test_math.py: suite.addTest(unittest.makeSuite(IsCloseTests))
msg401691 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-13 07:49
New changeset 851811f5772c43f72f445e2ce1ac3ea9da951ae3 by Serhiy Storchaka in branch 'main': bpo-5846: Do not use obsolete unittest functions. (GH-28303) https://github.com/python/cpython/commit/851811f5772c43f72f445e2ce1ac3ea9da951ae3
msg401878 - (view) Author: Ɓukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-15 18:34
New changeset ff6d2cc55aac5cc53e331cae145d0cf35ec647b0 by Erlend Egeberg Aasland in branch 'main': bpo-5846: Deprecate obsolete methods in `unittest` (GH-28299) https://github.com/python/cpython/commit/ff6d2cc55aac5cc53e331cae145d0cf35ec647b0
msg401899 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-15 19:50
I do not think that PR 28299 is correct. We want to deprecate these functions which are implemented in the unittest.loader module, not just names exported to the unittest module.
msg402014 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-17 09:09
New changeset b2b035a949eff1dc54b5bafe2bc9ce72b4d24438 by Serhiy Storchaka in branch 'main': bpo-5846: Fix deprecations for obsolete unittest functions and add tests. (GH-28382) https://github.com/python/cpython/commit/b2b035a949eff1dc54b5bafe2bc9ce72b4d24438
msg402016 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-09-17 09:13
_makeLoader is not deprecated yet, so we might keep this open a little bit more.
msg402042 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-17 11:54
It is an internal function. We can remove it without deprecation.
msg402126 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-09-18 12:12
> It is an internal function. We can remove it without deprecation. How convenient :)
History
Date User Action Args
2022-04-11 14:56:48 admin set github: 50096
2021-09-18 12:12:58 erlendaasland set messages: +
2021-09-17 11:54:09 serhiy.storchaka set messages: +
2021-09-17 09:13:12 erlendaasland set messages: +
2021-09-17 09:11:48 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2021-09-17 09:10:06 serhiy.storchaka set versions: + Python 3.11, - Python 3.4
2021-09-17 09:09:36 serhiy.storchaka set messages: +
2021-09-16 08:27:20 serhiy.storchaka set pull_requests: + <pull%5Frequest26797>
2021-09-15 19:50:36 serhiy.storchaka set messages: +
2021-09-15 18:34:09 lukasz.langa set nosy: + lukasz.langamessages: +
2021-09-13 07:49:57 serhiy.storchaka set messages: +
2021-09-13 06:16:57 serhiy.storchaka set nosy: + serhiy.storchakapull_requests: + <pull%5Frequest26717>
2021-09-12 21:14:28 erlendaasland set pull_requests: + <pull%5Frequest26713>
2021-02-09 10:45:14 erlendaasland set messages: +
2020-05-25 21:56:49 erlendaasland set keywords: + patchnosy: + erlendaaslandpull_requests: + <pull%5Frequest19663>stage: needs patch -> patch review
2012-09-26 17:29:06 ezio.melotti set type: enhancementversions: + Python 3.4, - Python 3.3
2011-03-16 02:24:46 ezio.melotti set stage: needs patchversions: + Python 3.3, - Python 3.1, Python 2.7
2011-01-03 22:48:26 ezio.melotti set nosy: + ezio.melotti
2009-05-11 21:48:40 michael.foord set messages: +
2009-05-07 08:24:24 georg.brandl set messages: +
2009-05-05 23:00:08 michael.foord set messages: +
2009-04-27 17:08:35 georg.brandl set nosy: + georg.brandlmessages: +
2009-04-25 23:44:59 michael.foord create