Refactored sqlite-utils insert tests into test_cli_insert.py

This commit is contained in:
Simon Willison 2022-01-05 17:57:03 -08:00
commit d1ed2f423d
3 changed files with 338 additions and 334 deletions

View file

@ -1,6 +1,12 @@
from sqlite_utils import Database
from sqlite_utils.utils import sqlite3
import pytest
CREATE_TABLES = """
create table Gosh (c1 text, c2 text, c3 text);
create table Gosh2 (c1 text, c2 text, c3 text);
"""
@pytest.fixture
def fresh_db():
@ -19,3 +25,11 @@ def existing_db():
"""
)
return database
@pytest.fixture
def db_path(tmpdir):
path = str(tmpdir / "test.db")
db = sqlite3.connect(path)
db.executescript(CREATE_TABLES)
return path