def db(app): _db.app = app with app.app_context(): _db.create_all() yield _db # Close db connection _db.session.close() _db.drop_all()
def app(): """ an application for the tests """ _app = create_app(TestConfig) with _app.app_context(): _db.create_all() ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()