Back to index

python3.2  3.2.2
Functions | Variables
importlib.test.import_.util Namespace Reference

Functions

def import_
def importlib_only
def mock_path_hook

Variables

 using___import__ = False

Function Documentation

def importlib.test.import_.util.import_ (   args,
  kwargs 
)
Delegate to allow for injecting different implementations of import.

Definition at line 10 of file util.py.

00010 
00011 def import_(*args, **kwargs):
00012     """Delegate to allow for injecting different implementations of import."""
00013     if using___import__:
00014         return __import__(*args, **kwargs)
00015     else:
00016         return importlib.__import__(*args, **kwargs)
00017 

Here is the call graph for this function:

Decorator to skip a test if using __builtins__.__import__.

Definition at line 18 of file util.py.

00018 
00019 def importlib_only(fxn):
00020     """Decorator to skip a test if using __builtins__.__import__."""
00021     return unittest.skipIf(using___import__, "importlib-specific test")(fxn)
00022 

def importlib.test.import_.util.mock_path_hook (   entries,
  importer 
)
A mock sys.path_hooks entry.

Definition at line 23 of file util.py.

00023 
00024 def mock_path_hook(*entries, importer):
00025     """A mock sys.path_hooks entry."""
00026     def hook(entry):
00027         if entry not in entries:
00028             raise ImportError
00029         return importer
00030     return hook

Variable Documentation

Definition at line 7 of file util.py.