File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,13 +255,15 @@ def conn_db_readwrite(tmp_path: Path) -> ConnDB:
255255
256256@pytest .fixture
257257def async_connection_readonly (tmp_path : Path ) -> lb .AsyncConnection :
258- """Return a cached read-only async connection."""
259- global _READONLY_ASYNC_CONNECTION_
260- if _READONLY_ASYNC_CONNECTION_ is None :
261- conn , db = create_conn_db (init_db (tmp_path ), read_only = True )
262- conn .close ()
263- _READONLY_ASYNC_CONNECTION_ = lb .AsyncConnection (db , max_threads_per_query = 4 )
264- return _READONLY_ASYNC_CONNECTION_
258+ """Return a read-only async connection."""
259+ conn , db = create_conn_db (init_db (tmp_path ), read_only = True )
260+ conn .close ()
261+ async_conn = lb .AsyncConnection (db , max_threads_per_query = 4 )
262+ try :
263+ yield async_conn
264+ finally :
265+ async_conn .close ()
266+ db .close ()
265267
266268
267269@pytest .fixture
You can’t perform that action at this time.
0 commit comments