diff --git a/tests/unit/test_repository.py b/tests/unit/test_repository.py index 488be46..57bc507 100644 --- a/tests/unit/test_repository.py +++ b/tests/unit/test_repository.py @@ -14,7 +14,8 @@ from py_dvt_ate.data.repository import SQLiteRepository @pytest.fixture def temp_db(): """Create a temporary database for testing.""" - with tempfile.TemporaryDirectory() as tmpdir: + # Use ignore_cleanup_errors=True for Windows file locking issues + with tempfile.TemporaryDirectory(ignore_cleanup_errors=True) as tmpdir: db_path = Path(tmpdir) / "test.db" yield db_path @@ -27,6 +28,7 @@ def repository(temp_db): yield repo # Ensure all connections and file handles are closed before cleanup # This is critical on Windows to prevent PermissionError + repo.close() del repo gc.collect()