File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414)
1515
1616if TYPE_CHECKING :
17+ from collections .abc import AsyncGenerator
18+
1719 from fakeredis import FakeAsyncRedis
1820
1921
2022@pytest .fixture (params = ['memory' , 'file_system' , 'sql' , 'redis' ])
21- def storage_client (
23+ async def storage_client (
2224 request : pytest .FixtureRequest ,
2325 redis_client : FakeAsyncRedis ,
24- ) -> StorageClient :
26+ ) -> AsyncGenerator [ StorageClient , None ] :
2527 """Parameterized fixture to test with different storage clients."""
2628 storage_client : StorageClient
2729
@@ -36,4 +38,7 @@ def storage_client(
3638 else :
3739 storage_client = FileSystemStorageClient ()
3840 service_locator .set_storage_client (storage_client )
39- return storage_client
41+ yield storage_client
42+
43+ if isinstance (storage_client , SqlStorageClient ):
44+ await storage_client .close ()
You can’t perform that action at this time.
0 commit comments