def test_load_tasks(self, cwd): cmd = Command() params = {'dodoFile': 'loader_sample.py', 'cwdPath': None, 'seek_file': False, } loader = DodoTaskLoader() task_list, config = loader.load_tasks(cmd, params, []) assert ['xxx1', 'yyy2'] == [t.name for t in task_list] assert {'verbose': 2} == config
def test_load_tasks(self, restore_cwd): os.chdir(os.path.dirname(__file__)) cmd = Command() params = {'dodoFile': 'loader_sample.py', 'cwdPath': None, 'seek_file': False, } loader = DodoTaskLoader() task_list, config = loader.load_tasks(cmd, params, []) assert ['xxx1', 'yyy2'] == [t.name for t in task_list] assert {'verbose': 2} == config
def test_load_tasks(self, restore_cwd): os.chdir(os.path.dirname(__file__)) cmd = Command() params = {'dodoFile': 'loader_sample.py', 'cwdPath': None, 'seek_file': False, } loader = DodoTaskLoader() loader.setup(params) config = loader.load_doit_config() task_list = loader.load_tasks(cmd, []) assert ['xxx1', 'yyy2'] == [t.name for t in task_list] assert {'verbose': 2} == config
def test_cmds_with_params(self, commands): output = StringIO() cmd = CmdFactory(TabCompletion, task_loader=DodoTaskLoader(), outstream=output, cmds=commands) cmd.execute({'shell':'zsh', 'hardcode_tasks': False}, []) got = output.getvalue() assert "tabcompletion: generate script" in got
def test_cmds_with_params(self, doit_app): output = StringIO() cmd = TabCompletion(task_loader=DodoTaskLoader(), outstream=output) cmd.doit_app = doit_app cmd.execute({'shell': 'zsh', 'hardcode_tasks': False}, []) got = output.getvalue() assert "tabcompletion: generate script" in got
def test_with_dodo__dinamic_tasks(self, commands): output = StringIO() cmd = CmdFactory(TabCompletion, task_loader=DodoTaskLoader(), outstream=output, cmds=commands) cmd.execute({'shell':'bash', 'hardcode_tasks': False}, []) got = output.getvalue() assert 'dodof' in got assert 't1' not in got assert 'tabcompletion' in got
def test_with_dodo__dinamic_tasks(self, doit_app): output = StringIO() cmd = TabCompletion(task_loader=DodoTaskLoader(), outstream=output) cmd.doit_app = doit_app cmd.execute({'shell': 'bash', 'hardcode_tasks': False}, []) got = output.getvalue() assert 'dodof' in got assert 't1' not in got assert 'tabcompletion' in got
def cmd_run(request, depfile_name): output = StringIO() cmd = Run(task_loader=DodoTaskLoader()) params, _ = cmd.cmdparser.parse([]) params['outfile'] = output params['dodoFile'] = os.path.join(SAMPLE_DIR, 'dodo.py') params['cwdPath'] = SAMPLE_DIR params['dep_file'] = depfile_name cmd.params = params # hack to make params available from fixture return cmd
def test(self): class MyCmd(DoitCmdBase): doc_purpose = "fake for testing" doc_usage = "[TASK ...]" doc_description = None opt_my = { 'name': 'my_opt', 'short': 'm', 'long': 'mine', 'type': str, 'default': 'xxx', 'help': "my option" } cmd_options = (opt_my, ) def _execute(self, my_opt): return my_opt mycmd = MyCmd(DodoTaskLoader()) assert 'min' == mycmd.parse_execute(['--mine', 'min'])