peewee-plus/tests/fixtures.py
Ethan Paul adab90736c
Add PathField class for storing pathlib objects
Add tests for pathfield class
Add database fixture for generating test databases
2021-11-24 18:34:19 -05:00

23 lines
477 B
Python

import uuid
import peewee
import pytest
@pytest.fixture(scope="function")
def fakedb(tmp_path):
"""Create a temporary pho-database (fakedb) for testing fields"""
sqlite = peewee.SqliteDatabase(
tmp_path / f"{uuid.uuid4()}.db",
pragmas={
"journal_mode": "wal",
"cache_size": -1 * 64000,
"foreign_keys": 1,
"ignore_check_constraints": 0,
"synchronous": 0,
},
)
yield sqlite