diff options
author | Brett Cannon <brett@python.org> | 2012-05-11 18:48:41 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-05-11 18:48:41 (GMT) |
commit | c049952de76cbcd00e490e48445ed7a50d3dc83a (patch) | |
tree | 91d1ff6bffbb8d6c5b04a8bae6b53944eb078335 /Lib/test/test_tools.py | |
parent | 0c59b039b86afa9f51c30f7d9f340d9c75984488 (diff) | |
download | cpython-c049952de76cbcd00e490e48445ed7a50d3dc83a.zip cpython-c049952de76cbcd00e490e48445ed7a50d3dc83a.tar.gz cpython-c049952de76cbcd00e490e48445ed7a50d3dc83a.tar.bz2 |
Issue #13959: Have
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
Diffstat (limited to 'Lib/test/test_tools.py')
-rw-r--r-- | Lib/test/test_tools.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/test/test_tools.py b/Lib/test/test_tools.py index bc2672d..cbe6d80 100644 --- a/Lib/test/test_tools.py +++ b/Lib/test/test_tools.py @@ -6,7 +6,7 @@ Tools directory of a Python checkout or tarball, such as reindent.py. import os import sys -import imp +import importlib.machinery import unittest from unittest import mock import sysconfig @@ -80,7 +80,8 @@ class PdepsTests(unittest.TestCase): @classmethod def setUpClass(self): path = os.path.join(scriptsdir, 'pdeps.py') - self.pdeps = imp.load_source('pdeps', path) + loader = importlib.machinery.SourceFileLoader('pdeps', path) + self.pdeps = loader.load_module() @classmethod def tearDownClass(self): @@ -104,7 +105,8 @@ class Gprof2htmlTests(unittest.TestCase): def setUp(self): path = os.path.join(scriptsdir, 'gprof2html.py') - self.gprof = imp.load_source('gprof2html', path) + loader = importlib.machinery.SourceFileLoader('gprof2html', path) + self.gprof = loader.load_module() oldargv = sys.argv def fixup(): sys.argv = oldargv |