Skip to content

Commit ba7242b

Browse files
committed
Try closing the database before recreating it, refs #503
1 parent f6b7962 commit ba7242b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_recreate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from sqlite_utils import Database
22
import sqlite3
3-
import time
43
import pathlib
54
import pytest
65

@@ -28,8 +27,9 @@ def test_recreate(tmp_path, use_path, create_file_first):
2827
if use_path:
2928
filepath = pathlib.Path(filepath)
3029
if create_file_first:
31-
Database(filepath)["t1"].insert({"foo": "bar"})
32-
assert ["t1"] == Database(filepath).table_names()
33-
time.sleep(0.1)
30+
db = Database(filepath)
31+
db["t1"].insert({"foo": "bar"})
32+
assert ["t1"] == db.table_names()
33+
db.conn.close()
3434
Database(filepath, recreate=True)["t2"].insert({"foo": "bar"})
3535
assert ["t2"] == Database(filepath).table_names()

0 commit comments

Comments
 (0)