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
def test_load_mypack_mysubpack_twentyfive(): obj = loader.load('mypack.mysubpack.mymod:twentyfive') assert inspect.isfunction(obj) assert obj() == 25
def test_load_mypack_mysubpack_mymod(): obj = loader.load('mypack.mysubpack.mymod') assert inspect.ismodule(obj) assert obj.__name__ == 'mypack.mysubpack.mymod'
def test_load_mypack_mysubpack_four(): obj = loader.load('mypack.mysubpack:four') assert inspect.isfunction(obj) assert obj() == 4
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"
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"
def test_load_mypack_one(): obj = loader.load('mypack:one') assert inspect.isfunction(obj) assert obj() == 1
def test_load_mypack(): obj = loader.load('mypack') assert inspect.ismodule(obj) assert obj.__name__ == 'mypack'
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"
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
def test_load_path_mypack_mymod_sixteen(): obj = loader.load(path=[os.getcwd()], name='mypack.mymod:sixteen') assert inspect.isfunction(obj) assert obj() == 16
def test_load_mypack_mymod_five(): obj = loader.load('mypack.mymod:five') assert inspect.isfunction(obj) assert obj() == 5
def test_import_all(): module_names = load("zirkon:__all__") for module_name in module_names: module = load("zirkon:{}".format(module_name))
def test_import_obj(obj_name): load('zirkon:{}'.format(obj_name))