Skip to content

Commit 76703a4

Browse files
committed
Fixes tests_comp_taskss_listenting_tasks.py
1 parent 049191c commit 76703a4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

services/web/server/src/simcore_service_webserver/computation_comp_tasks_listening_task.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ async def comp_tasks_listening_task(app: web.Application) -> None:
163163

164164

165165
async def setup_comp_tasks_listening_task(app: web.Application):
166-
task = asyncio.get_event_loop().create_task(comp_tasks_listening_task(app))
166+
task = asyncio.create_task(comp_tasks_listening_task(app))
167167
yield
168168
task.cancel()
169169
await task

services/web/server/tests/unit/with_dbs/fast/test_comp_tasks_listening_task.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ async def comp_task_listening_task(
7272
@pytest.mark.parametrize(
7373
"update_values, expected_calls",
7474
[
75-
# pytest.param(
76-
# {
77-
# "outputs": {"some new stuff": "it is new"},
78-
# },
79-
# ["_get_project_owner", "_update_project_outputs"],
80-
# id="new output shall trigger",
81-
# ),
75+
pytest.param(
76+
{
77+
"outputs": {"some new stuff": "it is new"},
78+
},
79+
["_get_project_owner", "_update_project_outputs"],
80+
id="new output shall trigger",
81+
),
8282
pytest.param(
8383
{"state": StateType.ABORTED},
8484
["_get_project_owner", "_update_project_state"],
@@ -122,18 +122,18 @@ async def test_listen_comp_tasks_task(
122122
.where(comp_tasks.c.task_id == task["task_id"])
123123
)
124124

125-
# tests whether calls executed
125+
# tests whether listener gets hooked calls executed
126126
for call_name, mocked_call in mock_project_subsystem.items():
127127
if call_name in expected_calls:
128-
for attempt in tenacity.Retrying(
128+
# async.sleep if and retry if not called
129+
async for attempt in tenacity.AsyncRetrying(
129130
wait=tenacity.wait_fixed(1),
130131
stop=tenacity.stop_after_delay(10),
131132
retry=tenacity.retry_if_exception_type(AssertionError),
132133
before=tenacity.before_log(logger, logging.INFO),
133134
reraise=True,
134135
):
135136
with attempt:
136-
print(call_name)
137137
mocked_call.assert_awaited()
138138
else:
139139
mocked_call.assert_not_called()

0 commit comments

Comments
 (0)