summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/import_/util.py
blob: dcb490f96754256ad780b8f730dc5e8e353ef9c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from .. import util

frozen_importlib, source_importlib = util.import_importlib('importlib')

import builtins
import functools
import importlib
import unittest


__import__ = staticmethod(builtins.__import__), staticmethod(source_importlib.__import__)


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