def testStatus(self, depfile): output = StringIO.StringIO() cmds.doit_list(depfile.name, tasks_sample(), output, ['g1'], print_status=True) got = [line.strip() for line in output.getvalue().split('\n') if line] expected = ['R g1'] assert expected == got
def testSubTask(self, depfile): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(depfile.name, tasks, output, [], print_subtasks=True) got = [line.strip() for line in output.getvalue().split('\n') if line] expected = [t.name for t in sorted(tasks)] assert expected == got
def testSubTask(self): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(TESTDB, tasks, output, [], print_subtasks=True) got = [line for line in output.getvalue().split('\n') if line] expected = [t.name for t in tasks] assert expected == got
def testDependencies(self, depfile): my_task = Task("t2", [""], file_dep=['d2.txt']) output = StringIO.StringIO() cmds.doit_list(depfile.name, [my_task], output, [], print_dependencies=True) got = output.getvalue() assert "d2.txt" in got
def testDefault(self, depfile): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(depfile.name, tasks, output, []) got = [line.strip() for line in output.getvalue().split('\n') if line] expected = [t.name for t in tasks if not t.is_subtask] assert sorted(expected) == got
def testDefault(self): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(TESTDB, tasks, output, []) got = [line for line in output.getvalue().split('\n') if line] expected = [t.name for t in tasks if not t.is_subtask] assert expected == got
def testNoPrivate(self, depfile): task_list = list(tasks_sample()) task_list.append(Task("_s3", [""])) output = StringIO.StringIO() cmds.doit_list(depfile.name, task_list, output, ['_s3']) got = [line.strip() for line in output.getvalue().split('\n') if line] expected = [] assert expected == got
def testWithPrivate(self): task_list = list(tasks_sample()) task_list.append(Task("_s3", [""])) output = StringIO.StringIO() cmds.doit_list(TESTDB, task_list, output, ['_s3'], print_private=True) got = [line for line in output.getvalue().split('\n') if line] expected = ['_s3'] assert expected == got
def testDoc(self): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(TESTDB, tasks, output, [], print_doc=True) got = [line for line in output.getvalue().split('\n') if line] expected = [] for t in tasks: if not t.is_subtask: expected.append("%s\t* %s" % (t.name, t.doc)) assert expected == got
def testDoc(self, depfile): output = StringIO.StringIO() tasks = tasks_sample() cmds.doit_list(depfile.name, tasks, output, [], print_doc=True) got = [line for line in output.getvalue().split('\n') if line] expected = [] for t in sorted(tasks): if not t.is_subtask: expected.append([t.name, t.doc]) assert len(expected) == len(got) for exp1, got1 in zip(expected, got): assert exp1 == got1.split(None, 1)
def cmd_list(params, args): """execute cmd 'list' """ dodo_tasks = loader.get_tasks(*_path_params(params)) params.update_defaults(dodo_tasks['config']) return doit_list(params['dep_file'], dodo_tasks['task_list'], sys.stdout, args, params['all'], not params['quiet'], params['status'], params['private'], params['list_deps'])
def testFilterSubtask(self, depfile): output = StringIO.StringIO() cmds.doit_list(depfile.name, tasks_sample(), output, ['g1.a']) got = [line.strip() for line in output.getvalue().split('\n') if line] expected = ['g1.a'] assert expected == got
def testStatus(self): output = StringIO.StringIO() cmds.doit_list(TESTDB, tasks_sample(), output, ['g1'], print_status=True) got = [line for line in output.getvalue().split('\n') if line] expected = ['R g1'] assert expected == got
def testFilterAll(self): output = StringIO.StringIO() cmds.doit_list(TESTDB, tasks_sample(), output, ['g1'], print_subtasks=True) got = [line for line in output.getvalue().split('\n') if line] expected = ['g1', 'g1.a', 'g1.b'] assert expected == got
def testFilterSubtask(self): output = StringIO.StringIO() cmds.doit_list(TESTDB, tasks_sample(), output, ['g1.a']) got = [line for line in output.getvalue().split('\n') if line] expected = ['g1.a'] assert expected == got