예제 #1
0
    def test_dependencies(self):

        t1 = Task(a=1)
        t2 = Task(a=2)
        t3 = Task(a=3, requirements=[t1, t2])
        self.assertEqual(t3.get_requirements(), [t1, t2])

        f1 = File("outputblah1.txt")
        f2 = File("outputblah2.txt")
        t1.get_outputs = lambda: [f1]
        t2.get_outputs = lambda: [f2]

        self.assertEqual(t1.complete(), False)
        self.assertEqual(t2.complete(), False)
        self.assertEqual(t3.requirements_satisfied(), False)

        f1.set_fake()

        self.assertEqual(t1.complete(), True)
        self.assertEqual(t2.complete(), False)
        self.assertEqual(t3.requirements_satisfied(), False)

        f2.set_fake()

        self.assertEqual(t1.complete(), True)
        self.assertEqual(t2.complete(), True)
        self.assertEqual(t3.requirements_satisfied(), True)
예제 #2
0
 def test_set_fake(self):
     f = File("does_not_exist.root")
     self.assertEqual(f.exists(), False)
     f.set_fake()
     self.assertEqual(f.exists(), True)