|
8 | 8 | import pytest |
9 | 9 | import pytest_asyncio |
10 | 10 | from alembic.config import Config as AlembicConfig |
| 11 | +from celery import Celery |
11 | 12 | from httpx import AsyncClient |
12 | 13 | from sqlalchemy.ext.asyncio import ( |
13 | 14 | AsyncEngine, |
|
22 | 23 | from syncmaster.backend.utils.jwt import sign_jwt |
23 | 24 | from syncmaster.db.models import Base |
24 | 25 | from syncmaster.scheduler.settings import SchedulerAppSettings |
| 26 | +from syncmaster.worker import create_celery_app |
| 27 | +from syncmaster.worker.settings import WorkerAppSettings |
25 | 28 | from tests.mocks import UserTestRoles |
26 | 29 | from tests.settings import TestSettings |
27 | 30 | from tests.utils import prepare_new_database, run_async_migrations |
@@ -77,6 +80,11 @@ def scheduler_settings(request: pytest.FixtureRequest) -> SchedulerAppSettings: |
77 | 80 | return SchedulerAppSettings.parse_obj(request.param) |
78 | 81 |
|
79 | 82 |
|
| 83 | +@pytest.fixture(scope="session", params=[{}]) |
| 84 | +def worker_settings(request: pytest.FixtureRequest) -> WorkerAppSettings: |
| 85 | + return WorkerAppSettings.parse_obj(request.param) |
| 86 | + |
| 87 | + |
80 | 88 | @pytest.fixture(scope="session") |
81 | 89 | def test_settings(): |
82 | 90 | return TestSettings() |
@@ -130,6 +138,12 @@ async def client(settings: Settings) -> AsyncGenerator: |
130 | 138 | logger.info("END CLIENT FIXTURE") |
131 | 139 |
|
132 | 140 |
|
| 141 | +@pytest.fixture(scope="session", params=[{}]) |
| 142 | +def celery(worker_settings: WorkerAppSettings) -> Celery: |
| 143 | + celery_app = create_celery_app(worker_settings) |
| 144 | + return celery_app |
| 145 | + |
| 146 | + |
133 | 147 | @pytest_asyncio.fixture |
134 | 148 | async def create_connection_data(request): |
135 | 149 | if hasattr(request, "param"): |
|
0 commit comments