예제 #1
0
def test_flow_runner_uses_user_provided_executor():
    t = SuccessTask()
    with Flow(name="test") as f:
        result = t()
    with raise_on_exception():
        with pytest.raises(NotImplementedError):
            FlowRunner(flow=f).run(executor=Executor())
예제 #2
0
def test_flow_runner_uses_default_executor_on_flow_if_present():
    t = SuccessTask()
    with Flow(name="test", executor=Executor()) as flow:
        result = t()

    with raise_on_exception():
        with pytest.raises(NotImplementedError):
            FlowRunner(flow=flow).run()
예제 #3
0
 def test_other_states_raise_endrun(self, state):
     flow = Flow(name="test", tasks=[Task()])
     with pytest.raises(ENDRUN):
         FlowRunner(flow=flow).get_flow_run_state(
             state=state,
             task_states={},
             task_contexts={},
             return_tasks=set(),
             task_runner_state_handlers=[],
             executor=Executor(),
         )
예제 #4
0
 def test_is_pickleable_after_start(self):
     e = Executor()
     with e.start():
         post = cloudpickle.loads(cloudpickle.dumps(e))
         assert isinstance(post, Executor)
예제 #5
0
 def test_is_pickleable(self):
     e = Executor()
     post = cloudpickle.loads(cloudpickle.dumps(e))
     assert isinstance(post, Executor)
예제 #6
0
 def test_start_doesnt_do_anything(self):
     with Executor().start():
         assert True
예제 #7
0
 def test_wait_raises_notimplemented(self):
     with pytest.raises(NotImplementedError):
         Executor().wait([1])
예제 #8
0
 def test_submit_raises_notimplemented(self):
     with pytest.raises(NotImplementedError):
         Executor().submit(lambda: 1)