def client(): db_fd, app.app.config['DATABASE'] = tempfile.mkstemp() app.app.config['TESTING'] = True with app.app.test_client() as client: with app.app.app_context(): app.init_db() yield client os.close(db_fd) os.unlink(app.app.config['DATABASE'])
def setUp(self): """Set up a blank temp database before each test""" self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp() app.app.config['TESTING'] = True self.app = app.app.test_client() app.init_db()
from app.app import app, init_db from app.constantes import DEBUG if __name__ == "__main__": init_db() # app.run(debug=DEBUG)
from app.app import Kanban_app, init_db if __name__ == '__main__': init_db() # initialise database Kanban_app.run(port=5000, host='localhost', debug=True)
def setUp(self): self.db_fd, run.app.config['DATABASE'] = tempfile.mkstemp() run.app.config['TESTING'] = True self.app = run.app.test_client() app.init_db()
def setUp(self): self.db_fd, app.config['DATABASE'] = tempfile.mkstemp() app.config['TESTING'] = True self.app = app.test_client() with app.app_context(): app.init_db()
def setUp(self): """Set up a blank temp db before each test""" self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp() app.app.config['TESTING'] = True self.app = app.app.test_client() app.init_db()