[Checkins] SVN: z3c.sampledata/trunk/src/z3c/sampledata/layer.py Update the testlayer to fix the closing bug

Jürgen Kartnaller juergen at kartnaller.at
Wed May 30 06:10:20 EDT 2007


Log message for revision 75994:
  Update the testlayer to fix the closing bug

Changed:
  U   z3c.sampledata/trunk/src/z3c/sampledata/layer.py

-=-
Modified: z3c.sampledata/trunk/src/z3c/sampledata/layer.py
===================================================================
--- z3c.sampledata/trunk/src/z3c/sampledata/layer.py	2007-05-30 10:00:50 UTC (rev 75993)
+++ z3c.sampledata/trunk/src/z3c/sampledata/layer.py	2007-05-30 10:10:19 UTC (rev 75994)
@@ -87,14 +87,22 @@
             connection.close()
             db.close()
 
+        # sets up the db stuff normal
+        fsetup.setUp()
+        # replace the storage with our filestorage
         fsetup.base_storage = FileStorage(filename)
-        fsetup.setUp()
+        # override close on this instance, so files dont get closed on
+        # setup/teardown of functionsetup
+        fsetup.base_storage.close = lambda : None
 
     def tearDown(self):
         fsetup = functional.FunctionalTestSetup()
-        fsetup.base_storage.close()
+        # close the filestorage files now by calling the original
+        # close on our storage instance
+        FileStorage.close(fsetup.base_storage)
         fsetup.base_storage = self.original
         fsetup.tearDown()
+        fsetup.tearDownCompletely()
 
     def _createParam(self, manager):
         # create the neccessary parameters from the schemas



More information about the Checkins mailing list