@pytest.fixture
def import_fake(monkeypatch):
 fake = ImportFake()
 monkeypatch.setattr('builtins.__import__', fake.fake_import)
 monkeypatch.setattr('qutebrowser.utils.version.importlib.import_module', fake.fake_importlib_import)
 return fake

@ pytest . fixture def import_fake ( monkeypatch ) : fake = ImportFake ( ) monkeypatch . setattr ( 'builtins.__import__' , fake . fake_import ) monkeypatch . setattr ( 'qutebrowser.utils.version.importlib.import_module' , fake . fake_importlib_import ) return fake
fixture to patch imports using importfake .