Skip to content

Commit 578b30d

Browse files
remove unused fixture
1 parent f317b34 commit 578b30d

File tree

6 files changed

+17
-26
lines changed

6 files changed

+17
-26
lines changed

services/storage/tests/conftest.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
from celery.signals import worker_init, worker_shutdown
2828
from celery.worker.worker import WorkController
2929
from celery_library.signals import on_worker_init, on_worker_shutdown
30-
from celery_library.task_manager import CeleryTaskManager
31-
from celery_library.utils import get_task_manager
3230
from faker import Faker
3331
from fakeredis.aioredis import FakeRedis
3432
from fastapi import FastAPI
@@ -365,7 +363,7 @@ def upload_file(
365363
create_upload_file_link_v2: Callable[..., Awaitable[FileUploadSchema]],
366364
create_file_of_size: Callable[[ByteSize, str | None], Path],
367365
create_simcore_file_id: Callable[[ProjectID, NodeID, str], SimcoreS3FileID],
368-
with_storage_celery_worker: CeleryTaskManager,
366+
with_storage_celery_worker: TestWorkController,
369367
) -> Callable[
370368
[ByteSize, str, SimcoreS3FileID | None], Awaitable[tuple[Path, SimcoreS3FileID]]
371369
]:
@@ -480,7 +478,7 @@ async def create_empty_directory(
480478
create_simcore_file_id: Callable[[ProjectID, NodeID, str], SimcoreS3FileID],
481479
create_upload_file_link_v2: Callable[..., Awaitable[FileUploadSchema]],
482480
client: httpx.AsyncClient,
483-
with_storage_celery_worker: CeleryTaskManager,
481+
with_storage_celery_worker: TestWorkController,
484482
) -> Callable[[str, ProjectID, NodeID], Awaitable[SimcoreS3FileID]]:
485483
async def _directory_creator(
486484
dir_name: str, project_id: ProjectID, node_id: NodeID
@@ -993,7 +991,7 @@ def _(celery_app: Celery) -> None: ...
993991

994992

995993
@pytest.fixture
996-
async def with_storage_celery_worker_controller(
994+
async def with_storage_celery_worker(
997995
app_environment: EnvVarsDict,
998996
celery_app: Celery,
999997
monkeypatch: pytest.MonkeyPatch,
@@ -1028,14 +1026,6 @@ def _on_worker_init_wrapper(sender: WorkController, **_kwargs):
10281026
yield worker
10291027

10301028

1031-
@pytest.fixture
1032-
def with_storage_celery_worker(
1033-
with_storage_celery_worker_controller: TestWorkController,
1034-
) -> CeleryTaskManager:
1035-
assert isinstance(with_storage_celery_worker_controller.app, Celery)
1036-
return get_task_manager(with_storage_celery_worker_controller.app)
1037-
1038-
10391029
@pytest.fixture
10401030
async def storage_rabbitmq_rpc_client(
10411031
rabbitmq_rpc_client: Callable[[str], Awaitable[RabbitMQRPCClient]],

services/storage/tests/unit/test_async_jobs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
import pytest
1212
from celery import Celery, Task
13+
from celery.contrib.testing.worker import TestWorkController
1314
from celery_library.models import TaskID, TaskMetadata
1415
from celery_library.task import register_task
15-
from celery_library.task_manager import CeleryTaskManager
1616
from fastapi import FastAPI
1717
from models_library.api_schemas_rpc_async_jobs.async_jobs import (
1818
AsyncJobGet,
@@ -202,7 +202,7 @@ async def test_async_jobs_workflow(
202202
initialized_app: FastAPI,
203203
register_rpc_routes: None,
204204
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
205-
with_storage_celery_worker: CeleryTaskManager,
205+
with_storage_celery_worker: TestWorkController,
206206
user_id: UserID,
207207
product_name: ProductName,
208208
exposed_rpc_start: str,
@@ -250,7 +250,7 @@ async def test_async_jobs_cancel(
250250
initialized_app: FastAPI,
251251
register_rpc_routes: None,
252252
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
253-
with_storage_celery_worker: CeleryTaskManager,
253+
with_storage_celery_worker: TestWorkController,
254254
user_id: UserID,
255255
product_name: ProductName,
256256
exposed_rpc_start: str,
@@ -315,7 +315,7 @@ async def test_async_jobs_raises(
315315
initialized_app: FastAPI,
316316
register_rpc_routes: None,
317317
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
318-
with_storage_celery_worker: CeleryTaskManager,
318+
with_storage_celery_worker: TestWorkController,
319319
user_id: UserID,
320320
product_name: ProductName,
321321
exposed_rpc_start: str,

services/storage/tests/unit/test_handlers_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from aiohttp import ClientSession
2424
from aws_library.s3 import S3KeyNotFoundError, S3ObjectKey, SimcoreS3API
2525
from aws_library.s3._constants import MULTIPART_UPLOADS_MIN_TOTAL_SIZE
26-
from celery_library.task_manager import CeleryTaskManager
26+
from celery.contrib.testing.worker import TestWorkController
2727
from faker import Faker
2828
from fastapi import FastAPI
2929
from models_library.api_schemas_storage.storage_schemas import (
@@ -683,7 +683,7 @@ async def test_upload_real_file_with_s3_client(
683683
node_id: NodeID,
684684
faker: Faker,
685685
s3_client: S3Client,
686-
with_storage_celery_worker: CeleryTaskManager,
686+
with_storage_celery_worker: TestWorkController,
687687
):
688688
file_size = TypeAdapter(ByteSize).validate_python("500Mib")
689689
file_name = faker.file_name()

services/storage/tests/unit/test_modules_celery.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pytest
1414
from celery import Celery, Task
1515
from celery.contrib.abortable import AbortableTask
16+
from celery.contrib.testing.worker import TestWorkController
1617
from celery_library.errors import TransferrableCeleryError
1718
from celery_library.models import (
1819
TaskContext,
@@ -42,7 +43,7 @@
4243
@pytest.fixture
4344
def celery_client(
4445
initialized_app: FastAPI,
45-
with_storage_celery_worker: CeleryTaskManager,
46+
with_storage_celery_worker: TestWorkController,
4647
) -> CeleryTaskManager:
4748
return get_task_manager_from_app(initialized_app)
4849

services/storage/tests/unit/test_rpc_handlers_paths.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from typing import Any, TypeAlias
1414

1515
import pytest
16-
from celery_library.task_manager import CeleryTaskManager
16+
from celery.contrib.testing.worker import TestWorkController
1717
from faker import Faker
1818
from fastapi import FastAPI
1919
from models_library.api_schemas_rpc_async_jobs.async_jobs import (
@@ -265,7 +265,7 @@ async def test_path_compute_size_inexistent_path(
265265
mock_celery_app: None,
266266
initialized_app: FastAPI,
267267
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
268-
with_storage_celery_worker: CeleryTaskManager,
268+
with_storage_celery_worker: TestWorkController,
269269
location_id: LocationID,
270270
user_id: UserID,
271271
faker: Faker,
@@ -294,7 +294,7 @@ async def test_delete_paths_empty_set(
294294
user_id: UserID,
295295
location_id: LocationID,
296296
product_name: ProductName,
297-
with_storage_celery_worker: CeleryTaskManager,
297+
with_storage_celery_worker: TestWorkController,
298298
):
299299
await _assert_delete_paths(
300300
storage_rabbitmq_rpc_client,
@@ -333,7 +333,7 @@ async def test_delete_paths(
333333
],
334334
project_params: ProjectWithFilesParams,
335335
product_name: ProductName,
336-
with_storage_celery_worker: CeleryTaskManager,
336+
with_storage_celery_worker: TestWorkController,
337337
):
338338
assert (
339339
len(project_params.allowed_file_sizes) == 1

services/storage/tests/unit/test_rpc_handlers_simcore_s3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async def test_copy_folders_from_non_existing_project(
113113
product_name: ProductName,
114114
create_project: Callable[..., Awaitable[dict[str, Any]]],
115115
faker: Faker,
116-
with_storage_celery_worker: CeleryTaskManager,
116+
with_storage_celery_worker: TestWorkController,
117117
):
118118
src_project = await create_project()
119119
incorrect_src_project = deepcopy(src_project)
@@ -154,7 +154,7 @@ async def test_copy_folders_from_empty_project(
154154
product_name: ProductName,
155155
create_project: Callable[[], Awaitable[dict[str, Any]]],
156156
sqlalchemy_async_engine: AsyncEngine,
157-
with_storage_celery_worker: CeleryTaskManager,
157+
with_storage_celery_worker: TestWorkController,
158158
):
159159
# we will copy from src to dst
160160
src_project = await create_project()

0 commit comments

Comments
 (0)