Spaces:
Sleeping
Sleeping
File size: 462 Bytes
e11c373 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import pytest
import sqlite3
from blossomtune_gradio import database
@pytest.fixture
def in_memory_db(mocker):
"""
Fixture to set up and tear down an in-memory SQLite database for tests.
It ensures that the same connection object is used for both schema
initialization and the test execution.
"""
con = sqlite3.connect(":memory:")
mocker.patch("sqlite3.connect", return_value=con)
database.init()
yield con
con.close()
|