peewee-plus/tests/fixtures.py

19 lines
348 B
Python
Raw Permalink Normal View History

import uuid
import peewee
import pytest
2021-11-25 03:41:58 +00:00
import peewee_plus
@pytest.fixture(scope="function")
def fakedb(tmp_path):
"""Create a temporary pho-database (fakedb) for testing fields"""
sqlite = peewee.SqliteDatabase(
str(tmp_path / f"{uuid.uuid4()}.db"),
2021-11-25 03:41:58 +00:00
pragmas=peewee_plus.SQLITE_DEFAULT_PRAGMAS,
)
yield sqlite