Module
zope.testing.cleanup

Provide a standard cleanup registry

Unit tests that change global data should include the CleanUp base class, which provides simpler setUp and tearDown methods that call global-data cleanup routines:

  class Test(CleanUp, unittest.TestCase):

      ....

If custom setUp or tearDown are needed, then the base routines should be called, as in:

  def tearDown(self):
      super(Test, self).tearDown()
      ....

Cleanup routines for global data should be registered by passing them to addCleanup:

  addCleanUp(pigRegistry._clear)