Skip to content

Commit

Permalink
use pytest-asyncio event_loop fixture
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Bantilan <[email protected]>
  • Loading branch information
cosmicBboy committed Sep 10, 2024
1 parent c9b0e38 commit 7b4899a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/flytekit/unit/experimental/test_eager_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def eager_wf_flyte_directory() -> str:
@mock.patch("flytekit.core.data_persistence.FileAccessProvider.get_data")
@mock.patch("flytekit.core.data_persistence.FileAccessProvider.put_data")
@mock.patch("flytekit.core.utils.write_proto_to_file")
def test_eager_workflow_dispatch(*args):
def test_eager_workflow_dispatch(mock_write_to_file, mock_put_data, mock_get_data, mock_load_proto, event_loop):
"""Test that event loop is preserved after executing eager workflow via dispatch."""

@eager
Expand All @@ -301,9 +301,6 @@ async def eager_wf():
ctx.execution_state.with_params(mode=context_manager.ExecutionState.Mode.TASK_EXECUTION)
)
) as ctx:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.events.set_event_loop(loop)
_dispatch_execute(ctx, lambda: eager_wf, "inputs path", "outputs prefix")
loop_after_execute = asyncio.get_event_loop_policy().get_event_loop()
assert loop == loop_after_execute
assert event_loop == loop_after_execute

0 comments on commit 7b4899a

Please sign in to comment.