Beispiel #1
0
def init():
    """Initialize Lando API (Create the DB, etc.)"""
    # Create the database and set the alembic version to
    # head revision.
    from landoapi.storage import alembic, db
    db.create_all()
    alembic.stamp('head')
Beispiel #2
0
def db(app):
    """Reset database for each test."""
    with app.app_context():
        _db.init_app(app)
        _db.create_all()
        yield _db
        _db.session.remove()
        _db.drop_all()
def db(app):
    """Reset database for each test."""
    with app.app_context():
        db_subsystem.init_app(app)
        try:
            _db.engine.connect()
        except sqlalchemy.exc.OperationalError:
            if EXTERNAL_SERVICES_SHOULD_BE_PRESENT:
                raise
            else:
                pytest.skip("Could not connect to PostgreSQL")
        _db.create_all()
        yield _db
        _db.session.remove()
        _db.drop_all()