Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

fix(tests): close the sqlite connection before renaming the folder (#3696)

X773e1e087aa260
diff --git a/tests/unit/cli/test_next_cmd.py b/tests/unit/cli/test_next_cmd.py
index 3d32158bc..952e91902 100644
--- a/tests/unit/cli/test_next_cmd.py
+++ b/tests/unit/cli/test_next_cmd.py
@@ -10,6 +10,7 @@ import asyncio
import datetime
import json
import sqlite3
+from contextlib import closing
from pathlib import Path
from typing import Any
@@ -264,7 +265,7 @@ def test_reads_a_repo_local_index_after_the_folder_is_moved(
asyncio.run(_build_index(original))
if outdated_schema:
# Reconciliation must finish before the relocated repository is read.
- with sqlite3.connect(original / ".repowise" / "wiki.db") as conn:
+ with closing(sqlite3.connect(original / ".repowise" / "wiki.db")) as conn:
conn.execute("ALTER TABLE health_file_metrics DROP COLUMN analyzed_commit")
moved = tmp_path / "moved"
original.rename(moved)