canaille-globuzma/tests/backends/sql/fixtures.py
Éloi Rivard 27639081f0
feat: implement sqlalchemy backend
Co-authored-by: Loan Robert <loan@yaal.coop>
2023-11-24 13:57:46 +01:00

18 lines
452 B
Python

import pytest
from canaille.backends.sql.backend import Backend
@pytest.fixture
def sqlalchemy_configuration(configuration):
configuration["BACKENDS"] = {
"SQL": {"SQL_DATABASE_URI": "sqlite:///:memory:"},
}
yield configuration
del configuration["BACKENDS"]
@pytest.fixture
def sql_backend(sqlalchemy_configuration):
backend = Backend(sqlalchemy_configuration)
with backend.session(init=True):
yield backend