Parameterized fixture to test with different storage clients.
(
request: pytest.FixtureRequest,
redis_client: FakeAsyncRedis,
)
| 21 | |
| 22 | @pytest.fixture(params=['memory', 'file_system', 'sql', 'redis']) |
| 23 | async def storage_client( |
| 24 | request: pytest.FixtureRequest, |
| 25 | redis_client: FakeAsyncRedis, |
| 26 | ) -> AsyncGenerator[StorageClient, None]: |
| 27 | """Parameterized fixture to test with different storage clients.""" |
| 28 | storage_client: StorageClient |
| 29 | |
| 30 | storage_type = request.param |
| 31 | |
| 32 | if storage_type == 'memory': |
| 33 | storage_client = MemoryStorageClient() |
| 34 | elif storage_type == 'sql': |
| 35 | storage_client = SqlStorageClient() |
| 36 | elif storage_type == 'redis': |
| 37 | storage_client = RedisStorageClient(redis=redis_client) |
| 38 | else: |
| 39 | storage_client = FileSystemStorageClient() |
| 40 | service_locator.set_storage_client(storage_client) |
| 41 | yield storage_client |
| 42 | |
| 43 | if isinstance(storage_client, SqlStorageClient): |
| 44 | await storage_client.close() |
nothing calls this directly
no test coverage detected