Skip to content

Commit 21fabbc

Browse files
committed
Parallelize test_sql.py - added explicit connection cleanup for all sqlite connection fixtures
1 parent ccc303a commit 21fabbc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

pandas/tests/io/test_sql.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,13 @@ def sqlite_adbc_conn():
909909
pytest.importorskip("adbc_driver_sqlite")
910910
from adbc_driver_sqlite import dbapi
911911

912-
with tm.ensure_clean() as name:
913-
uri = f"file:{name}"
914-
with dbapi.connect(uri) as conn:
915-
yield conn
912+
try:
913+
with tm.ensure_clean() as name:
914+
uri = f"file:{name}"
915+
with dbapi.connect(uri) as conn:
916+
yield conn
917+
finally:
918+
conn.close()
916919

917920

918921
@pytest.fixture
@@ -942,7 +945,11 @@ def sqlite_adbc_types(sqlite_adbc_conn, types_data):
942945

943946
@pytest.fixture
944947
def sqlite_buildin():
945-
yield sqlite3.connect(":memory:")
948+
try:
949+
conn = sqlite3.connect(":memory:")
950+
yield conn
951+
finally:
952+
conn.close()
946953

947954

948955
@pytest.fixture

0 commit comments

Comments
 (0)