didier/tests/conftest.py

16 lines
448 B
Python
Raw Normal View History

2022-06-17 00:43:55 +02:00
import pytest
from alembic import command, config
@pytest.fixture(scope="session")
def tables():
"""Initialize a database before the tests, and then tear it down again
Starts from an empty database and runs through all the migrations to check those as well
while we're at it
"""
alembic_config = config.Config("alembic.ini")
command.upgrade(alembic_config, "head")
yield
command.downgrade(alembic_config, "base")