Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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)
Esempio n. 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'])
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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