Skip to content

Commit dcef2f1

Browse files
committed
minor changes
1 parent 07ee77a commit dcef2f1

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

packages/celery-library/tests/unit/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _on_worker_init_wrapper(sender: WorkController, **_kwargs) -> None:
127127

128128

129129
@pytest.fixture
130-
def with_storage_celery_worker(
130+
def with_celery_worker(
131131
celery_worker_controller: TestWorkController,
132132
) -> CeleryTaskWorker:
133133
assert isinstance(celery_worker_controller.app, Celery)

packages/celery-library/tests/unit/test_async_jobs.py

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

44
import asyncio
55
import pickle
6-
from collections.abc import Callable
6+
from collections.abc import Awaitable, Callable
77
from datetime import timedelta
88
from enum import Enum
99
from typing import Any
@@ -108,12 +108,19 @@ async def async_job(task: Task, task_id: TaskID, action: Action, payload: Any) -
108108

109109

110110
@pytest.fixture
111-
async def rpc_client(
111+
async def register_routes(
112112
initialized_fast_api: FastAPI, rpc_namespace: RPCNamespace
113-
) -> RabbitMQRPCClient:
113+
) -> None:
114114
client = initialized_fast_api.state.rabbitmq_rpc_client
115115
assert isinstance(client, RabbitMQRPCClient)
116116
await client.register_router(router, rpc_namespace, initialized_fast_api)
117+
118+
119+
@pytest.fixture
120+
async def rpc_client(
121+
rabbitmq_rpc_client: Callable[[str], Awaitable[RabbitMQRPCClient]],
122+
) -> RabbitMQRPCClient:
123+
client = await rabbitmq_rpc_client("celery_test_client")
117124
return client
118125

119126

@@ -204,9 +211,10 @@ async def _wait_for_job(
204211
],
205212
)
206213
async def test_async_jobs_workflow(
214+
register_routes,
207215
rpc_client: RabbitMQRPCClient,
208216
rpc_namespace: RPCNamespace,
209-
with_storage_celery_worker: CeleryTaskWorker,
217+
with_celery_worker: CeleryTaskWorker,
210218
user_id: UserID,
211219
product_name: ProductName,
212220
exposed_rpc_start: str,
@@ -257,7 +265,7 @@ async def test_async_jobs_cancel(
257265
register_rpc_routes: None,
258266
rpc_namespace: RPCNamespace,
259267
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
260-
with_storage_celery_worker: CeleryTaskWorker,
268+
with_celery_worker: CeleryTaskWorker,
261269
user_id: UserID,
262270
product_name: ProductName,
263271
exposed_rpc_start: str,
@@ -325,7 +333,7 @@ async def test_async_jobs_raises(
325333
register_rpc_routes: None,
326334
rpc_namespace: RPCNamespace,
327335
storage_rabbitmq_rpc_client: RabbitMQRPCClient,
328-
with_storage_celery_worker: CeleryTaskWorker,
336+
with_celery_worker: CeleryTaskWorker,
329337
user_id: UserID,
330338
product_name: ProductName,
331339
exposed_rpc_start: str,

packages/celery-library/tests/unit/test_modules_celery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@pytest.fixture
4444
def celery_client(
4545
initialized_app: FastAPI,
46-
with_storage_celery_worker: CeleryTaskWorker,
46+
with_celery_worker: CeleryTaskWorker,
4747
) -> CeleryTaskClient:
4848
return get_celery_client(initialized_app)
4949

0 commit comments

Comments
 (0)