From: Guilherme Polo Date: Mon, 2 Feb 2009 20:28:59 +0000 (+0000) Subject: Moving to importlib X-Git-Tag: v2.7a1~2140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b98cb43e4a4d374dde9d7aa665ee88a6d0edd6b9;p=python Moving to importlib --- diff --git a/Lib/lib-tk/test/runtktests.py b/Lib/lib-tk/test/runtktests.py index 6c974cff5a..402c3420dc 100644 --- a/Lib/lib-tk/test/runtktests.py +++ b/Lib/lib-tk/test/runtktests.py @@ -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