2013-11-08 14:34:59 -04:00
|
|
|
from .. import util
|
|
|
|
|
|
|
|
frozen_importlib, source_importlib = util.import_importlib('importlib')
|
|
|
|
|
|
|
|
import builtins
|
2009-02-01 00:28:04 -04:00
|
|
|
import functools
|
2009-08-27 20:44:18 -03:00
|
|
|
import importlib
|
|
|
|
import unittest
|
2009-02-01 00:28:04 -04:00
|
|
|
|
|
|
|
|
2013-11-08 14:34:59 -04:00
|
|
|
__import__ = staticmethod(builtins.__import__), staticmethod(source_importlib.__import__)
|
2009-02-01 00:28:04 -04:00
|
|
|
|
|
|
|
|
|
|
|
def mock_path_hook(*entries, importer):
|
|
|
|
"""A mock sys.path_hooks entry."""
|
|
|
|
def hook(entry):
|
|
|
|
if entry not in entries:
|
|
|
|
raise ImportError
|
|
|
|
return importer
|
|
|
|
return hook
|