test: update database test to suite windows
This commit is contained in:
@@ -18,11 +18,15 @@ class TestSQLiteStorageSystem:
|
|||||||
with tempfile.NamedTemporaryFile(suffix='.db', delete=False) as tmp_file:
|
with tempfile.NamedTemporaryFile(suffix='.db', delete=False) as tmp_file:
|
||||||
db_path = tmp_file.name
|
db_path = tmp_file.name
|
||||||
|
|
||||||
|
storage = None
|
||||||
try:
|
try:
|
||||||
storage = SQLiteStorageSystem(storage_file=db_path)
|
storage = SQLiteStorageSystem(storage_file=db_path)
|
||||||
assert storage is not None
|
assert storage is not None
|
||||||
assert os.path.exists(db_path)
|
assert os.path.exists(db_path)
|
||||||
finally:
|
finally:
|
||||||
|
# Close the database connection before deleting (required on Windows)
|
||||||
|
if storage is not None:
|
||||||
|
storage.close()
|
||||||
if os.path.exists(db_path):
|
if os.path.exists(db_path):
|
||||||
os.unlink(db_path)
|
os.unlink(db_path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user