Exemple #1
0
 def test_touch(self):
     path = base.random_alpha_num_word(16)
     try:
         self.assertFalse(os.path.exists(path))
         base.touch(path)
         self.assertTrue(os.path.exists(path))
         base.touch(path)
         self.assertTrue(os.path.exists(path))
     finally:
         base.remove(path)
Exemple #2
0
 def test_touch(self):
     path = base.random_alpha_num_word(16)
     try:
         self.assertFalse(os.path.exists(path))
         base.touch(path)
         self.assertTrue(os.path.exists(path))
         base.touch(path)
         self.assertTrue(os.path.exists(path))
     finally:
         base.remove(path)
    def testPersistentTaskRunCreateFile(self):
        """Running a persistent task with success creates the output file."""

        class PTask(workflow.LocalFSPersistentTask):
            def run(self):
                return self.SUCCESS

        flow = workflow.Workflow()
        file_path = base.random_alpha_num_word(16)
        try:
            task = PTask(output_file_path=file_path, task_id="task", workflow=flow)
            flow.build()
            self.assertFalse(os.path.exists(file_path))
            self.assertTrue(flow.process())
            self.assertTrue(os.path.exists(file_path))
        finally:
            base.remove(file_path)
    def testPersistentTaskNoRunIfFile(self):
        """Persistent task does not run if output file already exists."""

        class PTask(workflow.LocalFSPersistentTask):
            def run(self):
                return self.FAILURE

        flow = workflow.Workflow()
        file_path = base.random_alpha_num_word(16)
        base.touch(file_path)
        try:
            task = PTask(output_file_path=file_path, task_id="task", workflow=flow)
            flow.build()
            self.assertTrue(os.path.exists(file_path))
            self.assertTrue(flow.process())
            self.assertTrue(os.path.exists(file_path))
        finally:
            base.remove(file_path)
Exemple #5
0
    def testPersistentTaskRunCreateFile(self):
        """Running a persistent task with success creates the output file."""
        class PTask(workflow.LocalFSPersistentTask):
            def run(self):
                return self.SUCCESS

        flow = workflow.Workflow()
        file_path = base.random_alpha_num_word(16)
        try:
            task = PTask(
                output_file_path=file_path,
                task_id='task',
                workflow=flow,
            )
            flow.build()
            self.assertFalse(os.path.exists(file_path))
            self.assertTrue(flow.process())
            self.assertTrue(os.path.exists(file_path))
        finally:
            base.remove(file_path)
Exemple #6
0
    def testPersistentTaskNoRunIfFile(self):
        """Persistent task does not run if output file already exists."""
        class PTask(workflow.LocalFSPersistentTask):
            def run(self):
                return self.FAILURE

        flow = workflow.Workflow()
        file_path = base.random_alpha_num_word(16)
        base.touch(file_path)
        try:
            task = PTask(
                output_file_path=file_path,
                task_id='task',
                workflow=flow,
            )
            flow.build()
            self.assertTrue(os.path.exists(file_path))
            self.assertTrue(flow.process())
            self.assertTrue(os.path.exists(file_path))
        finally:
            base.remove(file_path)