Call ds.close() in more places in tests

Refs #2692
This commit is contained in:
Simon Willison 2026-04-16 20:25:58 -07:00
commit d23b32c3e5
4 changed files with 5 additions and 14 deletions

View file

@ -22,12 +22,7 @@ def ds_write(tmp_path_factory):
ds = Datasette([db_path], immutables=[db_path_immutable])
ds.root_enabled = True
yield ds
# Close both setup connections plus any Datasette-managed connections.
db1.close()
db2.close()
for database in ds.databases.values():
if not database.is_memory:
database.close()
ds.close()
def write_token(ds, actor_id="root", permissions=None):

View file

@ -52,10 +52,7 @@ def ds_ct(tmp_path_factory):
)
ds.root_enabled = True
yield ds
db.close()
for database in ds.databases.values():
if not database.is_memory:
database.close()
ds.close()
@pytest.fixture
@ -95,10 +92,7 @@ def ds_ct_editor_permission(tmp_path_factory):
)
ds.root_enabled = True
yield ds
db.close()
for database in ds.databases.values():
if not database.is_memory:
database.close()
ds.close()
def write_token(ds, actor_id="root", permissions=None):

View file

@ -23,6 +23,7 @@ async def datasette_with_plugin():
yield datasette
finally:
datasette.pm.unregister(name="undo")
datasette.close()
# -- end datasette_with_plugin_fixture --

View file

@ -505,6 +505,7 @@ def ds_with_event_tracking(tmp_path):
ds.track_event = recording_track_event
yield ds
ds.close()
@pytest.mark.asyncio