Ejemplo n.º 1
0
    def test_process_lifecycle(self):
        step = PublishStep('parent')
        step.process = Mock()
        child_step = PublishStep('child')
        child_step.process = Mock()
        step.add_child(child_step)
        step.report_progress = Mock()

        step.process_lifecycle()

        step.process.assert_called_once_with()
        child_step.process.assert_called_once_with()
        step.report_progress.assert_called_once_with(force=True)
Ejemplo n.º 2
0
    def test_publish_exception_still_removes_working_dir(self, mock_rmtree):
        step = PublishStep("foo")
        work_dir = os.path.join(self.working_dir, 'foo')
        step.working_dir = work_dir
        step.process_lifecycle = Mock(side_effect=Exception('foo'))
        step._build_final_report = Mock()

        self.assertRaises(Exception, step.publish)
        self.assertTrue(step.process_lifecycle.called)
        self.assertFalse(step._build_final_report.called)
        mock_rmtree.assert_called_once_with(work_dir, ignore_errors=True)
Ejemplo n.º 3
0
    def test_publish(self, mock_rmtree):
        step = PublishStep("foo")
        work_dir = os.path.join(self.working_dir, 'foo')
        step.working_dir = work_dir
        step.process_lifecycle = Mock()
        step._build_final_report = Mock()

        step.publish()
        self.assertTrue(step.process_lifecycle.called)
        self.assertTrue(step._build_final_report.called)
        mock_rmtree.assert_called_once_with(work_dir, ignore_errors=True)
Ejemplo n.º 4
0
 def test_publish(self):
     # just test that process_lifecycle got called, that is where the functionality lives now
     step = PublishStep("foo")
     step.process_lifecycle = Mock()
     step.publish()
     self.assertTrue(step.process_lifecycle.called)