def tearDown(self):
"""
Tear down this test case by closing any existing database connection and deleting all of the
objects that were marked for deletion.
:return: None
"""
if len(self.to_delete) > 0:
for cur_delete in self.to_delete:
try:
self.db_session.delete(cur_delete)
except InvalidRequestError:
continue
self.db_session.commit()
if self._db_session is not None:
self._db_session.close()
if self._transaction is not None:
self._transaction.rollback()
if self._connection is not None:
self._connection.close()
super(BaseSqlalchemyTestCase, self).tearDown()
# Protected Methods
# Private Methods
评论列表
文章目录