summaryrefslogtreecommitdiff
path: root/Lib/test/test_importlib/test_threaded_import.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_importlib/test_threaded_import.py')
-rw-r--r--Lib/test/test_importlib/test_threaded_import.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/test_importlib/test_threaded_import.py b/Lib/test/test_importlib/test_threaded_import.py
index d1f8db42fb..221d0da20d 100644
--- a/Lib/test/test_importlib/test_threaded_import.py
+++ b/Lib/test/test_importlib/test_threaded_import.py
@@ -14,8 +14,9 @@ import shutil
import threading
import unittest
from unittest import mock
+from test import support
from test.support import (
- verbose, run_unittest, TESTFN, reap_threads,
+ verbose, TESTFN,
forget, unlink, rmtree, start_threads, script_helper)
def task(N, done, done_tasks, errors):
@@ -257,19 +258,16 @@ class ThreadedImportTests(unittest.TestCase):
script_helper.assert_python_ok(fn)
-@reap_threads
-def test_main():
- old_switchinterval = None
+def setUpModule():
+ thread_info = support.threading_setup()
+ unittest.addModuleCleanup(support.threading_cleanup, *thread_info)
try:
old_switchinterval = sys.getswitchinterval()
+ unittest.addModuleCleanup(sys.setswitchinterval, old_switchinterval)
sys.setswitchinterval(1e-5)
except AttributeError:
pass
- try:
- run_unittest(ThreadedImportTests)
- finally:
- if old_switchinterval is not None:
- sys.setswitchinterval(old_switchinterval)
+
if __name__ == "__main__":
- test_main()
+ unittets.main()