]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use importlib instead of calling __import__ directly.
authorBrett Cannon <brett@python.org>
Wed, 14 Nov 2012 18:42:51 +0000 (13:42 -0500)
committerBrett Cannon <brett@python.org>
Wed, 14 Nov 2012 18:42:51 +0000 (13:42 -0500)
Lib/test/regrtest.py

index c342d43fd516b8986efdb1e0c7b9e49ae266bbef..550a34db573f977b4ab2257a0bb92009a77f70ae 100755 (executable)
@@ -1210,8 +1210,7 @@ def runtest_inner(test, verbose, quiet,
             abstest = 'test.' + test
         with saved_test_environment(test, verbose, quiet) as environment:
             start_time = time.time()
-            the_package = __import__(abstest, globals(), locals(), [])
-            the_module = getattr(the_package, test)
+            the_module = importlib.import_module(abstest)
             # If the test has a test_main, that will run the appropriate
             # tests.  If not, use normal unittest test loading.
             test_runner = getattr(the_module, "test_main", None)