def test_run_uses_default_flow_runner(self, monkeypatch): x = MagicMock() monkeypatch.setattr("prefect.engine.flow_runner.FlowRunner", x) env = LocalEnvironment() built_env = env.build(prefect.Flow(name="test")) with prefect.utilities.configuration.set_temporary_config( {"engine.flow_runner.default_class": "prefect.engine.x"}): with pytest.warns(UserWarning): built_env.run() assert x.call_count == 1
def test_run(self): env = LocalEnvironment() state = env.build(error_flow()).run() assert state.is_failed()
def test_build_local_environment(self): env = LocalEnvironment() new_env = env.build(Flow(name="test")) assert isinstance(new_env, LocalEnvironment) assert env.serialized_flow is None assert new_env.serialized_flow is not None