def setUp(self): self.db_fd, web.app.config['DATABASE'] = tempfile.mkstemp() web.app.config['TESTING'] = True self.client = web.app.test_client() db.init_db(web.app) self.rctx = web.app.test_request_context() self.rctx.push() db.open_db(web.app)
def before_request(): db.open_db(app)
def db_context(self): with web.app.test_request_context(): db.open_db(web.app) yield db.close_db()