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())
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()
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(), )
def test_is_pickleable_after_start(self): e = Executor() with e.start(): post = cloudpickle.loads(cloudpickle.dumps(e)) assert isinstance(post, Executor)
def test_is_pickleable(self): e = Executor() post = cloudpickle.loads(cloudpickle.dumps(e)) assert isinstance(post, Executor)
def test_start_doesnt_do_anything(self): with Executor().start(): assert True
def test_wait_raises_notimplemented(self): with pytest.raises(NotImplementedError): Executor().wait([1])
def test_submit_raises_notimplemented(self): with pytest.raises(NotImplementedError): Executor().submit(lambda: 1)