summaryrefslogtreecommitdiff
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-09-20 09:34:52 +0300
committerGitHub <noreply@github.com>2021-09-20 09:34:52 +0300
commit5822ab672a1d26ff1837103c1ed8e4c3c2a42b87 (patch)
tree940df51015f39fafdef1287e646c406025c6cc83 /Lib/test/test_posix.py
parent41e2a31c13ba73e2c30e9bf0be9417fd17e8ace2 (diff)
downloadcpython-git-5822ab672a1d26ff1837103c1ed8e4c3c2a42b87.tar.gz
[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 40348acc180580371d25f75f46b27048e35f2435)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index f4edb8bd95..890b7e04da 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -2132,17 +2132,9 @@ class TestPosixWeaklinking(unittest.TestCase):
os.utime("path", dir_fd=0)
-def test_main():
- try:
- support.run_unittest(
- PosixTester,
- PosixGroupsTester,
- TestPosixSpawn,
- TestPosixSpawnP,
- TestPosixWeaklinking
- )
- finally:
- support.reap_children()
+def tearDownModule():
+ support.reap_children()
+
if __name__ == '__main__':
- test_main()
+ unittest.main()