diff options
author | Brett Cannon <brett@python.org> | 2012-04-22 19:58:33 -0400 |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-04-22 19:58:33 -0400 |
commit | 938d44d59c9cc142d35f51a908cabf781b482f26 (patch) | |
tree | 93d2bd601f966f742ef2f6caca7b374e84f6a0b2 /Lib/importlib/test/source/test_finder.py | |
parent | 8c5e920ae3e98ebc5b37a105cf86e4c1e9649f57 (diff) | |
download | cpython-938d44d59c9cc142d35f51a908cabf781b482f26.tar.gz cpython-938d44d59c9cc142d35f51a908cabf781b482f26.zip |
Issue #14605: Expose importlib.abc.FileLoader and
importlib.machinery.(FileFinder, SourceFileLoader,
_SourcelessFileLoader, ExtensionFileLoader).
This exposes all of importlib's mechanisms that will become public on
the sys module.
Diffstat (limited to 'Lib/importlib/test/source/test_finder.py')
-rw-r--r-- | Lib/importlib/test/source/test_finder.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/importlib/test/source/test_finder.py b/Lib/importlib/test/source/test_finder.py index 315aa77c714..f5de58a73e9 100644 --- a/Lib/importlib/test/source/test_finder.py +++ b/Lib/importlib/test/source/test_finder.py @@ -3,6 +3,7 @@ from . import util as source_util from importlib import _bootstrap import errno +import imp import os import py_compile from test.support import make_legacy_pyc @@ -35,9 +36,11 @@ class FinderTests(abc.FinderTests): """ def import_(self, root, module): - finder = _bootstrap._FileFinder(root, - _bootstrap._SourceFinderDetails(), - _bootstrap._SourcelessFinderDetails()) + loader_details = [(_bootstrap.SourceFileLoader, + _bootstrap._suffix_list(imp.PY_SOURCE), True), + (_bootstrap._SourcelessFileLoader, + _bootstrap._suffix_list(imp.PY_COMPILED), True)] + finder = _bootstrap.FileFinder(root, *loader_details) return finder.find_module(module) def run_test(self, test, create=None, *, compile_=None, unlink=None): @@ -135,7 +138,8 @@ class FinderTests(abc.FinderTests): def test_empty_string_for_dir(self): # The empty string from sys.path means to search in the cwd. - finder = _bootstrap._FileFinder('', _bootstrap._SourceFinderDetails()) + finder = _bootstrap.FileFinder('', (_bootstrap.SourceFileLoader, + _bootstrap._suffix_list(imp.PY_SOURCE), True)) with open('mod.py', 'w') as file: file.write("# test file for importlib") try: @@ -146,7 +150,8 @@ class FinderTests(abc.FinderTests): def test_invalidate_caches(self): # invalidate_caches() should reset the mtime. - finder = _bootstrap._FileFinder('', _bootstrap._SourceFinderDetails()) + finder = _bootstrap.FileFinder('', (_bootstrap.SourceFileLoader, + _bootstrap._suffix_list(imp.PY_SOURCE), True)) finder._path_mtime = 42 finder.invalidate_caches() self.assertEqual(finder._path_mtime, -1) |