def db(app): _db.app = app with app.app_context(): _db.create_all() yield _db _db.drop_all()
def app(): os.makedirs(config.STORAGE_CONTAINER) _app = create_app(config) with _app.app_context(): _db.create_all() ctx = _app.test_request_context() ctx.push() yield _app _db.drop_all() shutil.rmtree(config.STORAGE_CONTAINER) ctx.pop()