Since this question is a bit like your other question , I will copy the corresponding part of my answer here:
All test classes must be subclassed from the base class, which defines the general tearDown method:
class BaseTest(unittest.TestCase):
def setUp(self):
self.tearDown()
self.config = testing.setUp()
def tearDown(self):
testing.tearDown()
session.expunge_all()
session.rollback()
source
share