Skip to content

Commit c06d699

Browse files
committed
linter
1 parent 0d2e582 commit c06d699

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

services/web/server/tests/unit/with_dbs/04/notifications/test_notifications__db_comp_tasks_listening_task.py

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,29 @@
55
# pylint:disable=too-many-arguments
66
# pylint:disable=protected-access
77

8-
from ast import Assert
98
import asyncio
10-
from datetime import timedelta
119
import json
1210
import logging
1311
import secrets
1412
from collections.abc import AsyncIterator, Awaitable, Callable
1513
from dataclasses import dataclass
14+
from datetime import timedelta
15+
from pathlib import Path
1616
from typing import Any
1717
from unittest import mock
1818

1919
import pytest
20-
from tenacity import stop_after_attempt
21-
from common_library.async_tools import delayed_start
22-
from models_library.projects_nodes import InputsDict
23-
from pytest_simcore.helpers.logging_tools import log_context
2420
import simcore_service_webserver
2521
import simcore_service_webserver.db_listener
2622
import simcore_service_webserver.db_listener._db_comp_tasks_listening_task
2723
from aiohttp.test_utils import TestClient
24+
from common_library.async_tools import delayed_start
2825
from faker import Faker
2926
from models_library.projects import ProjectAtDB
27+
from models_library.projects_nodes import InputsDict
3028
from pytest_mock import MockType
3129
from pytest_mock.plugin import MockerFixture
30+
from pytest_simcore.helpers.logging_tools import log_context
3231
from pytest_simcore.helpers.webserver_users import UserInfoDict
3332
from simcore_postgres_database.models.comp_pipeline import StateType
3433
from simcore_postgres_database.models.comp_tasks import NodeClass, comp_tasks
@@ -37,14 +36,13 @@
3736
create_comp_tasks_listening_task,
3837
)
3938
from sqlalchemy.ext.asyncio import AsyncEngine
39+
from tenacity import stop_after_attempt
4040
from tenacity.asyncio import AsyncRetrying
4141
from tenacity.before_sleep import before_sleep_log
4242
from tenacity.retry import retry_if_exception_type
4343
from tenacity.stop import stop_after_delay
4444
from tenacity.wait import wait_fixed
4545

46-
from simcore_service_webserver.projects.models import ProjectDict
47-
4846
logger = logging.getLogger(__name__)
4947

5048

@@ -214,16 +212,11 @@ async def test_db_listener_triggers_on_event_with_multiple_tasks(
214212
assert any(
215213
call.args[1] == updated_task_id
216214
for call in spied_get_changed_comp_task_row.call_args_list
217-
), (
218-
f"_get_changed_comp_task_row was not called with task_id={updated_task_id}. Calls: {spied_get_changed_comp_task_row.call_args_list}"
219-
)
215+
), f"_get_changed_comp_task_row was not called with task_id={updated_task_id}. Calls: {spied_get_changed_comp_task_row.call_args_list}"
220216
else:
221217
spied_get_changed_comp_task_row.assert_not_called()
222218

223219

224-
from pathlib import Path
225-
226-
227220
@pytest.fixture
228221
def fake_2connected_jupyterlabs_workbench(tests_data_dir: Path) -> dict[str, Any]:
229222
fpath = tests_data_dir / "workbench_2connected_jupyterlabs.json"
@@ -264,7 +257,6 @@ async def _check_for_stability(
264257
)
265258

266259

267-
@pytest.mark.testit
268260
@pytest.mark.parametrize("user_role", [UserRole.USER])
269261
async def test_db_listener_upgrades_projects_row_correctly(
270262
with_started_listening_task: None,
@@ -289,19 +281,21 @@ async def test_db_listener_upgrades_projects_row_correctly(
289281
project_id=f"{some_project.uuid}",
290282
node_id=node_id,
291283
outputs=node_data.get("outputs", {}),
292-
node_class=NodeClass.INTERACTIVE
293-
if "dynamic" in node_data["key"]
294-
else NodeClass.COMPUTATIONAL,
284+
node_class=(
285+
NodeClass.INTERACTIVE
286+
if "dynamic" in node_data["key"]
287+
else NodeClass.COMPUTATIONAL
288+
),
295289
inputs=node_data.get("inputs", InputsDict()),
296290
)
297291
for node_id, node_data in fake_2connected_jupyterlabs_workbench.items()
298292
]
299293
assert len(tasks) == 2, "Expected two tasks for the two JupyterLab nodes"
300294
first_jupyter_task = tasks[0]
301295
second_jupyter_task = tasks[1]
302-
assert len(second_jupyter_task["inputs"]) > 0, (
303-
"Expected inputs for the second JupyterLab task"
304-
)
296+
assert (
297+
len(second_jupyter_task["inputs"]) > 0
298+
), "Expected inputs for the second JupyterLab task"
305299
number_of_inputs_linked = len(second_jupyter_task["inputs"])
306300

307301
# simulate a concurrent change in all the outputs of first jupyterlab
@@ -372,9 +366,9 @@ async def _check_retrieve_rpc_called(expected_ports_retrieved: int) -> None:
372366
mock_dynamic_service_rpc.call_args_list,
373367
)
374368
# Assert that the dynamic service RPC was called
375-
assert mock_dynamic_service_rpc.call_count > 0, (
376-
"Dynamic service retrieve RPC was not called"
377-
)
369+
assert (
370+
mock_dynamic_service_rpc.call_count > 0
371+
), "Dynamic service retrieve RPC was not called"
378372
# now get we check which ports were retrieved, we expect all of them
379373
all_ports = set()
380374
for call in mock_dynamic_service_rpc.call_args_list:

0 commit comments

Comments
 (0)