Karim shoair commited on
Commit
c230afb
·
1 Parent(s): dd0ca9f

test: update database test to suite windows

Browse files
Files changed (1) hide show
  1. tests/core/test_storage_core.py +5 -1
tests/core/test_storage_core.py CHANGED
@@ -17,12 +17,16 @@ class TestSQLiteStorageSystem:
17
  """Test SQLite storage with an actual file"""
18
  with tempfile.NamedTemporaryFile(suffix='.db', delete=False) as tmp_file:
19
  db_path = tmp_file.name
20
-
 
21
  try:
22
  storage = SQLiteStorageSystem(storage_file=db_path)
23
  assert storage is not None
24
  assert os.path.exists(db_path)
25
  finally:
 
 
 
26
  if os.path.exists(db_path):
27
  os.unlink(db_path)
28
 
 
17
  """Test SQLite storage with an actual file"""
18
  with tempfile.NamedTemporaryFile(suffix='.db', delete=False) as tmp_file:
19
  db_path = tmp_file.name
20
+
21
+ storage = None
22
  try:
23
  storage = SQLiteStorageSystem(storage_file=db_path)
24
  assert storage is not None
25
  assert os.path.exists(db_path)
26
  finally:
27
+ # Close the database connection before deleting (required on Windows)
28
+ if storage is not None:
29
+ storage.close()
30
  if os.path.exists(db_path):
31
  os.unlink(db_path)
32