[Zodb-checkins] CVS: Packages/bsddb3Storage - test_create.py:1.6

barry@digicool.com barry@digicool.com
Thu, 5 Apr 2001 17:16:52 -0400 (EDT)


Update of /cvs-repository/Packages/bsddb3Storage/test
In directory korak:/tmp/cvs-serv2848

Modified Files:
	test_create.py 
Log Message:
Changes to make the tests more robust under Windows.

tearDown(): Make sure any outstanding transactions are aborted so as
not to retain modified objects connected to closed databases.  Second,
call self._close() to free any resources.

_close(): Close the DB object, which in turn closes the underlying
storage.



--- Updated File test_create.py in package Packages/bsddb3Storage --
--- test_create.py	2001/04/03 18:38:56	1.5
+++ test_create.py	2001/04/05 21:16:51	1.6
@@ -22,7 +22,16 @@
             self.tearDown()
             raise
 
+    def _close(self):
+        self._db.close()
+
     def tearDown(self):
+        # If the tests exited with any uncommitted objects, they'll blow up
+        # subsequent tests because the next transaction commit will try to
+        # commit those object.  But they're tied to closed databases, so
+        # that's broken.  Aborting the transaction now saves us the headache.
+        get_transaction().abort()
+        self._close()
         for file in os.listdir(self._dbhome):
             os.unlink(os.path.join(self._dbhome, file))
         os.removedirs(self._dbhome)