def test_add_module_info(): # pylint: disable=no-member mod = types.ModuleType('testmodule') info1 = loader.add_module_info(mod) assert mod.__qute_module_info is info1 info2 = loader.add_module_info(mod) assert mod.__qute_module_info is info1 assert info2 is info1
def module(monkeypatch, request): mod = types.ModuleType('testmodule') monkeypatch.setattr(loader, '_module_infos', []) monkeypatch.setattr(loader.importlib, 'import_module', lambda _name: mod) mod.info = loader.add_module_info(mod) return mod
def _add_module_info(func: Callable) -> loader.ModuleInfo: """Add module info to the given function.""" module = importlib.import_module(func.__module__) return loader.add_module_info(module)
def _add_module_info(func: typing.Callable) -> loader.ModuleInfo: """Add module info to the given function.""" module = importlib.import_module(func.__module__) return loader.add_module_info(module)