]> granicus.if.org Git - python/commitdiff
Moving to importlib
authorGuilherme Polo <ggpolo@gmail.com>
Mon, 2 Feb 2009 20:28:59 +0000 (20:28 +0000)
committerGuilherme Polo <ggpolo@gmail.com>
Mon, 2 Feb 2009 20:28:59 +0000 (20:28 +0000)
Lib/lib-tk/test/runtktests.py

index 6c974cff5a83f4b0f944b710e5f01bdada83287a..402c3420dc0bd7dc423cf03790a590f2cb385b80 100644 (file)
@@ -9,6 +9,7 @@ Extensions also should live in packages following the same rule as above.
 import os
 import sys
 import unittest
+import importlib
 import test.test_support
 
 this_dir_path = os.path.abspath(os.path.dirname(__file__))
@@ -44,10 +45,8 @@ def get_tests_modules(basepath=this_dir_path, gui=True, packages=None):
 
             for name in filenames:
                 try:
-                    yield __import__(
-                            "%s.%s" % (pkg_name, name[:-len(py_ext)]),
-                            fromlist=['']
-                            )
+                    yield importlib.import_module(
+                            ".%s" % name[:-len(py_ext)], pkg_name)
                 except test.test_support.ResourceDenied:
                     if gui:
                         raise