Skip to content

Commit

Permalink
test(robot-server): Fix some "coroutine not awaited" warnings (#15954)
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring authored Aug 9, 2024
1 parent 58a7d19 commit fb937d8
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions robot-server/tests/runs/router/test_commands_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@ async def test_create_command_with_failed_command_raises(
command_create = pe_commands.HomeCreate(params=pe_commands.HomeParams())

decoy.when(
mock_run_orchestrator_store.add_command_and_wait_for_interval(
await mock_run_orchestrator_store.add_command_and_wait_for_interval(
pe_commands.HomeCreate(
params=pe_commands.HomeParams(),
intent=pe_commands.CommandIntent.SETUP,
),
failed_command_id="123",
wait_until_complete=False,
timeout=None,
)
).then_raise(pe_errors.CommandNotAllowedError())

with pytest.raises(ApiError):
await create_run_command(
run_id="run-id",
request_body=RequestModelWithCommandCreate(data=command_create),
waitUntilComplete=False,
timeout=42,
run_orchestrator_store=mock_run_orchestrator_store,
failedCommandId="123",
check_estop=True,
Expand Down Expand Up @@ -227,16 +227,18 @@ async def test_add_conflicting_setup_command(
)

decoy.when(
mock_run_orchestrator_store.add_command_and_wait_for_interval(
request=command_request, failed_command_id=None
await mock_run_orchestrator_store.add_command_and_wait_for_interval(
request=command_request,
failed_command_id=None,
wait_until_complete=False,
timeout=None,
)
).then_raise(pe_errors.SetupCommandNotAllowedError("oh no"))

with pytest.raises(ApiError) as exc_info:
await create_run_command(
run_id="run-id",
request_body=RequestModelWithCommandCreate(data=command_request),
waitUntilComplete=False,
run_orchestrator_store=mock_run_orchestrator_store,
failedCommandId=None,
check_estop=True,
Expand All @@ -260,16 +262,18 @@ async def test_add_command_to_stopped_engine(
)

decoy.when(
mock_run_orchestrator_store.add_command_and_wait_for_interval(
request=command_request, failed_command_id=None
await mock_run_orchestrator_store.add_command_and_wait_for_interval(
request=command_request,
failed_command_id=None,
wait_until_complete=False,
timeout=None,
)
).then_raise(pe_errors.RunStoppedError("oh no"))

with pytest.raises(ApiError) as exc_info:
await create_run_command(
run_id="run-id",
request_body=RequestModelWithCommandCreate(data=command_request),
waitUntilComplete=False,
run_orchestrator_store=mock_run_orchestrator_store,
failedCommandId=None,
check_estop=True,
Expand Down

0 comments on commit fb937d8

Please sign in to comment.