def test_pipeline_suspend(self, mocked_init): p = Pipeline() p._state = states.SCHEDULED p._state_history = [states.SCHEDULED] p.suspend() self.assertEqual(p._state, states.SUSPENDED) self.assertEqual(p._state_history, [states.SCHEDULED, states.SUSPENDED]) p = Pipeline() p._uid = 'pipeline.0000' p._state = states.SUSPENDED with self.assertRaises(EnTKError): p.suspend()
def test_pipeline_suspend_resume(): p = Pipeline() assert p.state == states.INITIAL p.suspend() assert p.state == states.SUSPENDED p.resume() assert p.state == states.INITIAL p.state = states.SCHEDULING assert p.state == states.SCHEDULING p.suspend() assert p.state == states.SUSPENDED p.resume() assert p.state == states.SCHEDULING with pytest.raises(EnTKError): p.resume() p.suspend() with pytest.raises(EnTKError): p.suspend()