def tearDown(self): # noqa # rollback - everything that happened with the Session above # (including calls to commit()) is rolled back. testing.tearDown() if not keep: self.trans.rollback() else: self.trans.commit() DBSession.remove() self.session.close() self.connection.close()
def setup_package(): # set up database engine = get_engine() DBSession.configure(bind=engine) alembic_config = _get_alembic_config() downgrade(alembic_config, 'base') initializedb.setup_db(alembic_config, DBSession) # set up ElasticSearch configure_es_from_config(settings) initializees.drop_index() initializees.setup_es() # Add test data needed for all tests with transaction.manager: _add_global_test_data(DBSession) fill_index(DBSession) DBSession.remove()