Example #1
0
def app():
    app = create_app(TestConfig())
    with app.app_context():
        db.drop_all()
        db.create_all()

    yield app
Example #2
0
    def _app(config_class, init_scheduler=False) -> Flask:
        __app: Flask = create_app(config_class, init_scheduler)

        if config_class is TestingConfig:
            db.drop_all()
            db.create_all()

        return __app
Example #3
0
def main():
    app = create_app()

    with app.app_context():
        db.drop_all()
        db.create_all()

        read_from_file_and_write_to_db()

        geocode_cities()
Example #4
0
 def initdb(drop):
     """Initialize the database."""
     if drop:
         click.confirm(
             'This operation will delete the database, do you want to continue?',
             abort=True)
         db.drop_all()
         click.echo('Drop tables.')
     db.create_all()
     click.echo('Initialized database.')
Example #5
0
def db(app):
    _db.app = app

    with app.app_context():
        _db.create_all()

    yield _db

    _db.session.close()
    _db.drop_all()
def db(app):
    """
    Setup our database, this only gets executed once per session.

    :param app: Pytest fixture
    :return: SQLAlchemy database session
    """
    _db.drop_all()
    _db.create_all()

    return _db
Example #7
0
def app() -> Flask:
    def _app(config_class, init_scheduler=False) -> Flask:
        __app: Flask = create_app(config_class, init_scheduler)

        if config_class is TestingConfig:
            db.drop_all()
            db.create_all()

        return __app

    yield _app
    db.session.remove()
    db.drop_all()
Example #8
0
def db():
    db_ext.create_all()
    yield db_ext
    db_ext.drop_all()
Example #9
0
def _drop_db():
    from backend.extensions import db

    click.echo('Dropping DB tables.')
    db.drop_all()
    db.engine.execute('DROP TABLE IF EXISTS alembic_version;')