def main(args=None): cfg_files = ( # first look in current dir os.path.join(os.getcwd(), ".vamosrc"), # then in home dir os.path.expanduser("~/.vamosrc"), ) tools = [PathTool()] return tools_main(tools, cfg_files, args)
def main(): cfg_files = ( # first look in current dir os.path.join(os.getcwd(), ".vamosrc"), # then in home dir os.path.expanduser("~/.vamosrc"), ) tools = [PathTool()] sys.exit(tools_main(tools, cfg_files))
def tools_path_simple_test(capsys, tmpdir): tools = [PathTool()] cwd = os.getcwd() cfg_dict = { "volumes": ["cwd:" + cwd], "path": { "vols_base_dir": str(tmpdir) } } res = tools_main(tools, args=["sys2ami", "tmp"], cfg_dict=cfg_dict) assert res == 0 captured = capsys.readouterr() assert captured.out.splitlines() == ["cwd:tmp"]
def tools_path_simple_test(capsys, tmpdir): tools = [PathTool()] cwd = os.getcwd() cfg_dict = { "volumes": [ "cwd:" + cwd ], "path": { "vols_base_dir" : str(tmpdir) } } res = tools_main(tools, args=['sys2ami', 'tmp'], cfg_dict=cfg_dict) assert res == 0 captured = capsys.readouterr() assert captured.out.splitlines() == [ "cwd:tmp" ]
def tools_main_multi_test(): tools = [Tool("tool1"), Tool("tool2")] res = tools_main(tools, args=["tool1"]) assert res == 0
def tools_main_single_test(): tools = [Tool("tool")] res = tools_main(tools, args=[]) assert res == 0