[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/testing/functional.py Implement ZCMLLayer.tearDown.

Marius Gedminas marius at pov.lt
Sat Jan 20 09:16:25 EST 2007


Log message for revision 72143:
  Implement ZCMLLayer.tearDown.
  
  As a result, the test runner no longer needs to run functional tests of all but
  the first layer in a subprocess, and you get progress indication and also can
  use pdb there.
  
  All tests (test.py --all) pass with this change.  I've also checked the
  contents of the adapter registry, the logging module configuration, the
  contents of the transaction, and the list of loggers registered with the Python
  logging framework.  All these are not changed by setting up and tearing down
  test layers.
  
  

Changed:
  U   Zope3/trunk/src/zope/app/testing/functional.py

-=-
Modified: Zope3/trunk/src/zope/app/testing/functional.py
===================================================================
--- Zope3/trunk/src/zope/app/testing/functional.py	2007-01-20 13:53:49 UTC (rev 72142)
+++ Zope3/trunk/src/zope/app/testing/functional.py	2007-01-20 14:16:24 UTC (rev 72143)
@@ -171,6 +171,12 @@
         self.db.close()
         setSite(None)
 
+    def tearDownCompletely(self):
+        """Cleans up the setup done by the constructor."""
+        zope.app.testing.setup.placefulTearDown()
+        self._config_file = False
+        self._init = False
+
     def getRootFolder(self):
         """Returns the Zope root folder."""
         if not self.connection:
@@ -182,6 +188,7 @@
         """Returns the Zope application instance."""
         return self.app
 
+
 class ZCMLLayer:
     """ZCML-defined test layer
     """
@@ -194,11 +201,12 @@
         self.__name__ = name
 
     def setUp(self):
-        FunctionalTestSetup(self.config_file)
+        self.setup = FunctionalTestSetup(self.config_file)
 
     def tearDown(self):
-        raise NotImplementedError
+        self.setup.tearDownCompletely()
 
+
 def defineLayer(name, zcml='test.zcml'):
     """Helper function for defining layers.
 



More information about the Zope3-Checkins mailing list