[Python-checkins] r57081 - in sandbox/trunk/import_in_py: _importlib.py tests/test_fs_importer.py
brett.cannon
python-checkins at python.org
Thu Aug 16 04:33:15 CEST 2007
Author: brett.cannon
Date: Thu Aug 16 04:33:15 2007
New Revision: 57081
Modified:
sandbox/trunk/import_in_py/_importlib.py
sandbox/trunk/import_in_py/tests/test_fs_importer.py
Log:
Move importlib.Import over to the new importer modules. This includes setting
them to use FileSystemLoader to make them fully functional.
Modified: sandbox/trunk/import_in_py/_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/_importlib.py (original)
+++ sandbox/trunk/import_in_py/_importlib.py Thu Aug 16 04:33:15 2007
@@ -297,19 +297,13 @@
return None
-# XXX Placeholder
-class ExtensionFileLoader(object):
- pass
-class PyFileLoader(object):
- pass
-
-
class ExtensionFileImporter(FileImporter):
"""Importer for extension files."""
_possible_package = False
- _loader = ExtensionFileLoader
+ #_loader = ExtensionFileLoader
+ _loader = lambda path: FileSystemLoader(path, ExtensionFileHandler)
def __init__(self, path_entry):
# Assigning to _file_types here instead of at the class level because
@@ -323,7 +317,7 @@
"""Importer for source/bytecode files."""
_possible_package = True
- _loader = PyFileLoader
+ _loader = lambda path: FileSystemLoader(path, PyPycHandler)
def __init__(self, path_entry):
self._file_types = [imp.PY_SOURCE, imp.PY_COMPILED]
@@ -331,7 +325,6 @@
-
class FileSystemImporter(object):
"""Importer for the filesystem using the passed-in handlers."""
Modified: sandbox/trunk/import_in_py/tests/test_fs_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/tests/test_fs_importer.py (original)
+++ sandbox/trunk/import_in_py/tests/test_fs_importer.py Thu Aug 16 04:33:15 2007
@@ -499,8 +499,9 @@
def test_main():
test_support.run_unittest(PyFileImporterTests, ExtensionFileImporterTests)
- #test_support.run_unittest(FileSystemFactoryTests, FileSystemImporterTests,
- # FileSystemLoaderBlackBoxTests, FileSystemLoaderWhiteBoxTests)
+ test_support.run_unittest(
+ #FileSystemFactoryTests, FileSystemImporterTests,
+ FileSystemLoaderBlackBoxTests, FileSystemLoaderWhiteBoxTests)
if __name__ == '__main__':
More information about the Python-checkins
mailing list