Example #1
0
def test_load_star():
    obj_dict = loader.load('mypack.mymod:*')
    assert 'five' in obj_dict
    assert 'six' in obj_dict
    assert 'ten' in obj_dict
    assert 'sixteen' in obj_dict
    assert len(obj_dict) == 4
Example #2
0
def test_load_mypack_mysubpack_twentyfive():
    obj = loader.load('mypack.mysubpack.mymod:twentyfive')
    assert inspect.isfunction(obj)
    assert obj() == 25
Example #3
0
def test_load_mypack_mysubpack_mymod():
    obj = loader.load('mypack.mysubpack.mymod')
    assert inspect.ismodule(obj)
    assert obj.__name__ == 'mypack.mysubpack.mymod'
Example #4
0
def test_load_mypack_mysubpack_four():
    obj = loader.load('mypack.mysubpack:four')
    assert inspect.isfunction(obj)
    assert obj() == 4
Example #5
0
def test_load_mypack_mymod2():
    with pytest.raises(loader.LoaderError) as exc_info:
        obj = loader.load('mypack.mymod2')
    assert str(exc_info.value) == "cannot load module mymod2 from mypack"
Example #6
0
def test_load_mypack_two():
    with pytest.raises(loader.LoaderError) as exc_info:
        obj = loader.load('mypack:two')
    assert str(exc_info.value) == "cannot load object two from mypack"
Example #7
0
def test_load_mypack_one():
    obj = loader.load('mypack:one')
    assert inspect.isfunction(obj)
    assert obj() == 1
Example #8
0
def test_load_mypack():
    obj = loader.load('mypack')
    assert inspect.ismodule(obj)
    assert obj.__name__ == 'mypack'
Example #9
0
def test_load_star_all_error():
    with pytest.raises(loader.LoaderError) as exc_info:
        obj_dict = loader.load('mypack.mymod_all_error:*')
    assert str(exc_info.value) == "cannot load object twenty from mypack.mymod_all_error"
Example #10
0
def test_load_abs_mypack_mymod_five():
    obj = loader.load(os.path.join(os.getcwd(), 'mypack.mymod:five'))
    assert inspect.isfunction(obj)
    assert obj() == 5
Example #11
0
def test_load_path_mypack_mymod_sixteen():
    obj = loader.load(path=[os.getcwd()], name='mypack.mymod:sixteen')
    assert inspect.isfunction(obj)
    assert obj() == 16
Example #12
0
def test_load_mypack_mymod_five():
    obj = loader.load('mypack.mymod:five')
    assert inspect.isfunction(obj)
    assert obj() == 5
Example #13
0
def test_import_all():
    module_names = load("zirkon:__all__")
    for module_name in module_names:
        module = load("zirkon:{}".format(module_name))
Example #14
0
def test_import_obj(obj_name):
    load('zirkon:{}'.format(obj_name))
Example #15
0
def test_import_all():
    module_names = load("zirkon:__all__")
    for module_name in module_names:
        module = load("zirkon:{}".format(module_name))
Example #16
0
def test_import_obj(obj_name):
    load('zirkon:{}'.format(obj_name))