mirror of
https://github.com/python/cpython.git
synced 2025-08-15 06:10:47 +00:00
[3.9] bpo-45229: Remove test_main in many tests (GH-28405) (GH-28456)
Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.
load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests..
(cherry picked from commit 40348acc18
)
This commit is contained in:
parent
41e2a31c13
commit
5822ab672a
61 changed files with 210 additions and 471 deletions
|
@ -1569,20 +1569,11 @@ class TestInternalUtilities(unittest.TestCase):
|
|||
self.assertIsNone(self._get_revised_path(trailing_argv0dir))
|
||||
|
||||
|
||||
@reap_threads
|
||||
def test_main():
|
||||
try:
|
||||
test.support.run_unittest(PydocDocTest,
|
||||
PydocImportTest,
|
||||
TestDescriptions,
|
||||
PydocServerTest,
|
||||
PydocUrlHandlerTest,
|
||||
TestHelper,
|
||||
PydocWithMetaClasses,
|
||||
TestInternalUtilities,
|
||||
)
|
||||
finally:
|
||||
reap_children()
|
||||
def setUpModule():
|
||||
thread_info = test.support.threading_setup()
|
||||
unittest.addModuleCleanup(test.support.threading_cleanup, *thread_info)
|
||||
unittest.addModuleCleanup(reap_children)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue