Skip to content

Commit 29f2298

Browse files
author
Andrei Neagu
committed
pylint
1 parent 60346ff commit 29f2298

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_event_create_sidecars.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from ....catalog import CatalogClient
3737
from ....db.repositories.groups_extra_properties import GroupsExtraPropertiesRepository
3838
from ....db.repositories.projects import ProjectsRepository
39-
from ....director_v0 import DirectorV0Client
4039
from ...docker_api import (
4140
constrain_service_to_node,
4241
create_network,
@@ -52,7 +51,7 @@
5251
merge_settings_before_use,
5352
)
5453
from ._abc import DynamicSchedulerEvent
55-
from ._events_utils import get_allow_metrics_collection, get_director_v0_client
54+
from ._events_utils import get_allow_metrics_collection
5655

5756
_logger = logging.getLogger(__name__)
5857

@@ -171,7 +170,7 @@ async def action(cls, app: FastAPI, scheduler_data: SchedulerData) -> None:
171170
# resources and placement derived from all the images in
172171
# the provided docker-compose spec
173172
# also other encodes the env vars to target the proper container
174-
director_v0_client: DirectorV0Client = get_director_v0_client(app)
173+
175174
# fetching project form DB and fetching user settings
176175
projects_repository = get_repository(app, ProjectsRepository)
177176

services/director-v2/tests/unit/test_modules_project_networks.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import json
55
from pathlib import Path
6-
from typing import Any, Iterable
6+
from typing import Any
77
from unittest.mock import AsyncMock, call
88
from uuid import UUID, uuid4
99

@@ -159,7 +159,7 @@ def mock_scheduler() -> AsyncMock:
159159

160160

161161
@pytest.fixture
162-
def mock_director_v0_client() -> AsyncMock:
162+
def mock_catalog_client() -> AsyncMock:
163163
return AsyncMock()
164164

165165

@@ -195,11 +195,11 @@ def fake_project_id() -> ProjectID:
195195

196196

197197
@pytest.fixture
198-
def mock_docker_calls(mocker: MockerFixture) -> Iterable[dict[str, AsyncMock]]:
198+
def mock_docker_calls(mocker: MockerFixture) -> dict[str, AsyncMock]:
199199
requires_dynamic_sidecar_mock = AsyncMock()
200200
requires_dynamic_sidecar_mock.return_value = True
201201
class_base = "simcore_service_director_v2.modules.dynamic_sidecar.scheduler._task.DynamicSidecarsScheduler"
202-
mocked_items = {
202+
return {
203203
"attach": mocker.patch(f"{class_base}.attach_project_network", AsyncMock()),
204204
"detach": mocker.patch(f"{class_base}.detach_project_network", AsyncMock()),
205205
"requires_dynamic_sidecar": mocker.patch(
@@ -208,8 +208,6 @@ def mock_docker_calls(mocker: MockerFixture) -> Iterable[dict[str, AsyncMock]]:
208208
),
209209
}
210210

211-
yield mocked_items
212-
213211

214212
async def test_send_network_configuration_to_dynamic_sidecar(
215213
mock_scheduler: AsyncMock,
@@ -230,7 +228,7 @@ async def test_send_network_configuration_to_dynamic_sidecar(
230228

231229

232230
async def test_get_networks_with_aliases_for_default_network_is_json_serializable(
233-
mock_director_v0_client: AsyncMock,
231+
mock_catalog_client: AsyncMock,
234232
fake_project_id: ProjectID,
235233
dy_workbench_with_networkable_labels: dict[str, Any],
236234
user_id: PositiveInt,
@@ -241,6 +239,6 @@ async def test_get_networks_with_aliases_for_default_network_is_json_serializabl
241239
project_id=fake_project_id,
242240
user_id=user_id,
243241
new_workbench=dy_workbench_with_networkable_labels,
244-
director_v0_client=mock_director_v0_client,
242+
catalog_client=mock_catalog_client,
245243
rabbitmq_client=rabbitmq_client,
246244
)

0 commit comments

Comments
 (0)