sanic_template/test/conftest.py
def sa_engine(replace_pg_url):
    """Create test db and apply migrations."""
    engine = sqlalchemy.create_engine(settings.PG_URL, echo=settings.PG_ECHO)
    if database_exists(engine.url):
        drop_database(engine.url)
    create_database(engine.url)
    alembic_migrate()
    yield engine
    drop_database(engine.url)
    engine.dispose()
Create test db and apply migrations.
Create test db and apply migrations.
Create test db and apply migrations .
def sa_engine(replace_pg_url):
    engine = sqlalchemy.create_engine(settings.PG_URL, echo=settings.PG_ECHO)
    if database_exists(engine.url):
        drop_database(engine.url)
    create_database(engine.url)
    alembic_migrate()
    yield engine
    drop_database(engine.url)
    engine.dispose()
def sa_engine ( replace_pg_url ) : engine = sqlalchemy . create_engine ( settings . PG_URL , echo = settings . PG_ECHO ) if database_exists ( engine . url ) : drop_database ( engine . url ) create_database ( engine . url ) alembic_migrate ( ) yield engine drop_database ( engine . url ) engine . dispose ( )
Create test db and apply migrations.
Create test db and apply migrations .
"""Create test db and apply migrations."""
replace_pg_url