예제 #1
0
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
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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)
예제 #6
0
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)