mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
Try closing the database before recreating it, refs #503
This commit is contained in:
parent
f6b796277f
commit
ba7242b1f2
1 changed files with 4 additions and 4 deletions
|
|
@ -1,6 +1,5 @@
|
|||
from sqlite_utils import Database
|
||||
import sqlite3
|
||||
import time
|
||||
import pathlib
|
||||
import pytest
|
||||
|
||||
|
|
@ -28,8 +27,9 @@ def test_recreate(tmp_path, use_path, create_file_first):
|
|||
if use_path:
|
||||
filepath = pathlib.Path(filepath)
|
||||
if create_file_first:
|
||||
Database(filepath)["t1"].insert({"foo": "bar"})
|
||||
assert ["t1"] == Database(filepath).table_names()
|
||||
time.sleep(0.1)
|
||||
db = Database(filepath)
|
||||
db["t1"].insert({"foo": "bar"})
|
||||
assert ["t1"] == db.table_names()
|
||||
db.conn.close()
|
||||
Database(filepath, recreate=True)["t2"].insert({"foo": "bar"})
|
||||
assert ["t2"] == Database(filepath).table_names()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue