def dummy_import(monkeypatch):  # (MonkeyPatch) -> Callable
    """
    This fixture monkeypatches the import mechanism to fail.

    After raising an `ImportError`, the monkeypatch is immediately removed.
    """

    def dummy_import(*args, **kwargs):
        try:
            raise ImportError("this is a monkeypatch")
        finally:
            monkeypatch.undo()

    return dummy_import