Skip to content
Permalink
Browse files

Better monkeypatching of cloud flow runner test

  • Loading branch information...
cicdw committed Aug 13, 2019
1 parent d6c81ca commit d997f2167c034cdfe60027cb6010c4dc997fbaa9
Showing with 3 additions and 9 deletions.
  1. +3 −9 tests/engine/cloud/test_cloud_flow_runner.py
@@ -402,7 +402,7 @@ def do_nothing():
assert isinstance(states[1].result, SyntaxError)


def test_starting_at_arbitrary_loop_index_from_cloud_context(monkeypatch):
def test_starting_at_arbitrary_loop_index_from_cloud_context(client):
@prefect.task
def looper(x):
if prefect.context.get("task_loop_count", 1) < 20:
@@ -417,16 +417,10 @@ def downstream(l):
inter = looper(10)
final = downstream(inter)

get_flow_run_info = MagicMock(
client.get_flow_run_info = MagicMock(
return_value=MagicMock(context={"task_loop_count": 20})
)
set_flow_run_state = MagicMock()
client = MagicMock(
get_flow_run_info=get_flow_run_info, set_flow_run_state=set_flow_run_state
)
monkeypatch.setattr(
"prefect.engine.cloud.flow_runner.Client", MagicMock(return_value=client)
)
client.set_flow_run_state = MagicMock()

flow_state = CloudFlowRunner(flow=f).run(return_tasks=[inter, final])

0 comments on commit d997f21

Please sign in to comment.
You can’t perform that action at this time.