Exemplo n.º 1
0
 def find_module(self):
     good_name = ext_util.NAME
     bad_name = good_name.upper()
     assert good_name != bad_name
     finder = _bootstrap._FileFinder(ext_util.PATH,
                                     _bootstrap._ExtensionFinderDetails())
     return finder.find_module(bad_name)
Exemplo n.º 2
0
 def test_empty_string_for_dir(self):
     # The empty string from sys.path means to search in the cwd.
     finder = _bootstrap._FileFinder('', _bootstrap._SourceFinderDetails())
     with open('mod.py', 'w') as file:
         file.write("# test file for importlib")
     try:
         loader = finder.find_module('mod')
         self.assertTrue(hasattr(loader, 'load_module'))
     finally:
         os.unlink('mod.py')
Exemplo n.º 3
0
 def test_empty_string_for_dir(self):
     # The empty string from sys.path means to search in the cwd.
     finder = _bootstrap._FileFinder('', _bootstrap._SourceFinderDetails())
     with open('mod.py', 'w') as file:
         file.write("# test file for importlib")
     try:
         loader = finder.find_module('mod')
         self.assertTrue(hasattr(loader, 'load_module'))
     finally:
         os.unlink('mod.py')
Exemplo n.º 4
0
 def find_module(self, fullname):
     importer = _bootstrap._FileFinder(util.PATH,
                                       _bootstrap._ExtensionFinderDetails())
     return importer.find_module(fullname)
Exemplo n.º 5
0
 def find(self, path):
     finder = _bootstrap._FileFinder(path,
                                     _bootstrap._SourceFinderDetails(),
                                     _bootstrap._SourcelessFinderDetails())
     return finder.find_module(self.name)
Exemplo n.º 6
0
 def test_success(self):
     # XXX Only work on existing directories?
     with source_util.create_modules("dummy") as mapping:
         self.assert_(hasattr(_bootstrap._FileFinder(mapping[".root"]), "find_module"))
Exemplo n.º 7
0
 def import_(self, root, module):
     finder = _bootstrap._FileFinder(root,
                                     _bootstrap._SourceFinderDetails(),
                                     _bootstrap._SourcelessFinderDetails())
     return finder.find_module(module)
 def find(self, path):
     finder = _bootstrap._FileFinder(path,
                                     _bootstrap._SourceFinderDetails(),
                                     _bootstrap._SourcelessFinderDetails())
     return finder.find_module(self.name)
Exemplo n.º 9
0
 def find_module(self, fullname):
     importer = _bootstrap._FileFinder(util.PATH,
                                       _bootstrap._ExtensionFinderDetails())
     return importer.find_module(fullname)
Exemplo n.º 10
0
 def import_(self, root, module):
     finder = _bootstrap._FileFinder(root,
                                     _bootstrap._SourceFinderDetails(),
                                     _bootstrap._SourcelessFinderDetails())
     return finder.find_module(module)
Exemplo n.º 11
0
 def test_success(self):
     # XXX Only work on existing directories?
     with source_util.create_modules('dummy') as mapping:
         self.assertTrue(
             hasattr(_bootstrap._FileFinder(mapping['.root']),
                     'find_module'))
 def test_success(self):
     # XXX Only work on existing directories?
     with source_util.create_modules('dummy') as mapping:
         self.assertTrue(hasattr(_bootstrap._FileFinder(mapping['.root']),
                              'find_module'))