mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
Try a 0.1s sleep, refs #503
This commit is contained in:
parent
c5d7ec1dd7
commit
f6b796277f
1 changed files with 6 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from sqlite_utils import Database
|
||||
import sqlite3
|
||||
import time
|
||||
import pathlib
|
||||
import pytest
|
||||
|
||||
|
|
@ -19,14 +20,16 @@ def test_recreate_not_allowed_for_connection():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"use_path,file_exists", [(True, True), (True, False), (False, True), (False, False)]
|
||||
"use_path,create_file_first",
|
||||
[(True, True), (True, False), (False, True), (False, False)],
|
||||
)
|
||||
def test_recreate(tmp_path, use_path, file_exists):
|
||||
def test_recreate(tmp_path, use_path, create_file_first):
|
||||
filepath = str(tmp_path / "data.db")
|
||||
if use_path:
|
||||
filepath = pathlib.Path(filepath)
|
||||
if file_exists:
|
||||
if create_file_first:
|
||||
Database(filepath)["t1"].insert({"foo": "bar"})
|
||||
assert ["t1"] == Database(filepath).table_names()
|
||||
time.sleep(0.1)
|
||||
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