def create_new_db(): # Drop old database, then make a new one. print('Clearing current database...') database.reflect() database.drop_all() print('Creating new database...') database.create_all() database.session.commit() print("Database created.") print("Loading data from JSON...")
def app(request): app = create_app(TestConfig) app.app_context().push() # def teardown(): # app.app_context().pop() # request.addfinalizer(teardown) # return app with app.app_context(): # alternative pattern to app.app_context().push() # all commands indented under 'with' are run in the app context database.create_all() yield app # Note that we changed return for yield, see below for why database.session.remove( ) # looks like db.session.close() would work as well database.drop_all()
def tearDown(self): database.session.remove() database.drop_all() self.app_context.pop()
def tearDown(self): database.drop_all() self.logout()
def reset(): database.drop_all() database.create_all() importData()
def tearDown(self): db.session.remove() db.drop_all()
def tearDown(self): database.session.remove() database.drop_all()
def tearDown(self): db.session.remove() db.drop_all() for table in db.engine.table_names(): db.engine.execute('DROP TABLE "{0}"'.format(table))
def setUp(self): database.session.close() database.drop_all() database.create_all()
def tearDown(self): database.session.close() database.drop_all()