示例#1
0
 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
示例#2
0
 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
示例#3
0
 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
示例#4
0
 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
示例#5
0
 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
示例#6
0
 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
示例#7
0
 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
示例#8
0
 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
示例#9
0
 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
示例#10
0
 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)
示例#11
0
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'])
示例#12
0
 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
示例#13
0
 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
示例#14
0
 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
示例#15
0
 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