Claude Code helped fix a ton of .close() warnings, refs #692

https://gistpreview.github.io/?730f0c5dc38528a1dd0615f330bd5481
This commit is contained in:
Simon Willison 2025-12-11 16:23:38 -08:00
commit 81b0599078
6 changed files with 119 additions and 30 deletions

View file

@ -16,7 +16,9 @@ def pytest_configure(config):
@pytest.fixture
def fresh_db():
return Database(memory=True)
db = Database(memory=True)
yield db
db.close()
@pytest.fixture
@ -30,7 +32,8 @@ def existing_db():
INSERT INTO foo (text) values ("three");
"""
)
return database
yield database
database.close()
@pytest.fixture
@ -38,4 +41,5 @@ def db_path(tmpdir):
path = str(tmpdir / "test.db")
db = sqlite3.connect(path)
db.executescript(CREATE_TABLES)
db.close()
return path