예제 #1
0
 def testDontForgetTaskDependency(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output, dep_file=depfile.name,
                         task_list=tasks, sel_tasks=["t3"])
     cmd_forget._execute()
     dep = Dependency(depfile.name)
     assert None == dep._get("t3", "dep")
     assert "1" == dep._get("t1", "dep")
예제 #2
0
 def testDontForgetTaskDependency(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output,
                         dep_file=depfile.name,
                         task_list=tasks,
                         sel_tasks=["t3"])
     cmd_forget._execute()
     dep = Dependency(depfile.name)
     assert None == dep._get("t3", "dep")
     assert "1" == dep._get("t1", "dep")
예제 #3
0
 def testForgetAll(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output, dep_file=depfile.name,
                         task_list=tasks, sel_tasks=[])
     cmd_forget._execute()
     got = output.getvalue().split("\n")[:-1]
     assert ["forgeting all tasks"] == got, repr(output.getvalue())
     dep = Dependency(depfile.name)
     for task in tasks:
         assert None == dep._get(task.name, "dep")
예제 #4
0
 def testForgetOne(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output, dep_file=depfile.name,
                         task_list=tasks, sel_tasks=["t2", "t1"])
     cmd_forget._execute()
     got = output.getvalue().split("\n")[:-1]
     assert ["forgeting t2", "forgeting t1"] == got
     dep = Dependency(depfile.name)
     assert None == dep._get("t1", "dep")
     assert None == dep._get("t2", "dep")
     assert "1" == dep._get("g1.a", "dep")
예제 #5
0
 def testForgetAll(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output,
                         dep_file=depfile.name,
                         task_list=tasks,
                         sel_tasks=[])
     cmd_forget._execute()
     got = output.getvalue().split("\n")[:-1]
     assert ["forgeting all tasks"] == got, repr(output.getvalue())
     dep = Dependency(depfile.name)
     for task in tasks:
         assert None == dep._get(task.name, "dep")
예제 #6
0
 def testForgetOne(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output,
                         dep_file=depfile.name,
                         task_list=tasks,
                         sel_tasks=["t2", "t1"])
     cmd_forget._execute()
     got = output.getvalue().split("\n")[:-1]
     assert ["forgeting t2", "forgeting t1"] == got
     dep = Dependency(depfile.name)
     assert None == dep._get("t1", "dep")
     assert None == dep._get("t2", "dep")
     assert "1" == dep._get("g1.a", "dep")
예제 #7
0
    def testForgetGroup(self, tasks, depfile_name):
        self._add_task_deps(tasks, depfile_name)
        output = StringIO()
        cmd_forget = Forget(outstream=output, dep_file=depfile_name,
                            backend='dbm', task_list=tasks, sel_tasks=["g1"])
        cmd_forget._execute(False)
        got = output.getvalue().split("\n")[:-1]
        assert "forgetting g1" == got[0]

        dep = Dependency(depfile_name)
        assert "1" == dep._get("t1", "dep")
        assert "1" == dep._get("t2", "dep")
        assert None == dep._get("g1", "dep")
        assert None == dep._get("g1.a", "dep")
        assert None == dep._get("g1.b", "dep")
예제 #8
0
 def testForgetInvalid(self, tasks, depfile):
     self._add_task_deps(tasks, depfile.name)
     output = StringIO()
     cmd_forget = Forget(outstream=output,
                         dep_file=depfile.name,
                         task_list=tasks,
                         sel_tasks=["XXX"])
     pytest.raises(InvalidCommand, cmd_forget._execute)
예제 #9
0
    def testForgetGroup(self, tasks, depfile_name):
        self._add_task_deps(tasks, depfile_name)
        output = StringIO()
        cmd_forget = Forget(outstream=output,
                            dep_file=depfile_name,
                            backend='dbm',
                            task_list=tasks,
                            sel_tasks=["g1"])
        cmd_forget._execute(False)
        got = output.getvalue().split("\n")[:-1]
        assert "forgetting g1" == got[0]

        dep = Dependency(depfile_name)
        assert "1" == dep._get("t1", "dep")
        assert "1" == dep._get("t2", "dep")
        assert None == dep._get("g1", "dep")
        assert None == dep._get("g1.a", "dep")
        assert None == dep._get("g1.b", "dep")