mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
bpo-5846: Do not use obsolete unittest functions. (GH-28303)
Get rid of use of makeSuite() and findTestCases(). Also make test_math and test_threading_local discoverable.
This commit is contained in:
parent
c78d5ca380
commit
851811f577
49 changed files with 80 additions and 93 deletions
|
@ -201,22 +201,19 @@ class PyThreadingLocalTest(unittest.TestCase, BaseLocalTest):
|
|||
_local = _threading_local.local
|
||||
|
||||
|
||||
def test_main():
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest(DocTestSuite('_threading_local'))
|
||||
suite.addTest(unittest.makeSuite(ThreadLocalTest))
|
||||
suite.addTest(unittest.makeSuite(PyThreadingLocalTest))
|
||||
def load_tests(loader, tests, pattern):
|
||||
tests.addTest(DocTestSuite('_threading_local'))
|
||||
|
||||
local_orig = _threading_local.local
|
||||
def setUp(test):
|
||||
_threading_local.local = _thread._local
|
||||
def tearDown(test):
|
||||
_threading_local.local = local_orig
|
||||
suite.addTest(DocTestSuite('_threading_local',
|
||||
setUp=setUp, tearDown=tearDown)
|
||||
)
|
||||
tests.addTests(DocTestSuite('_threading_local',
|
||||
setUp=setUp, tearDown=tearDown)
|
||||
)
|
||||
return tests
|
||||
|
||||
support.run_unittest(suite)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue