Exemplo n.º 1
0
    def test_pipeline_state_assignment(self, mocked_generate_id, mocked_Lock,
                                       mocked_Event, t, l, i, b):

        p = Pipeline()

        data_type = [l, i, b]

        for data in data_type:
            with self.assertRaises(TypeError):
                p.state = data

        if isinstance(t,str):
            with self.assertRaises(ValueError):
                p.state = t

        state_history = list()
        p = Pipeline()
        p._state = None
        p._state_history = list()
        states_list = list(states._pipeline_state_values.keys())
        shuffle(states_list)
        for val in states_list:
            p.state = val
            if val != states.SUSPENDED:
                state_history.append(val)
            self.assertEqual(p._state, val)
            self.assertEqual(p._state_history, state_history)
Exemplo n.º 2
0
def test_pipeline_state_assignment(t, l, i, b):

    p = Pipeline()

    data_type = [l, i, b]

    for data in data_type:
        with pytest.raises(TypeError):
            p.state = data

    if isinstance(t,str):
        with pytest.raises(ValueError):
            p.state = t

    for val in states._pipeline_state_values.keys():
        p.state = val
def test_pipeline_state_assignment(t, l, i, b):

    p = Pipeline()

    data_type = [l, i, b]

    for data in data_type:
        with pytest.raises(TypeError):
            p.state = data

    if isinstance(t,str):
        with pytest.raises(ValueError):
            p.state = t

    for val in states._pipeline_state_values.keys():
        p.state = val
Exemplo n.º 4
0
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()
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()