[Python-checkins] r61241 - python/trunk/Lib/bsddb/test/test_dbshelve.py python/trunk/Lib/bsddb/test/test_thread.py

neal.norwitz python-checkins at python.org
Wed Mar 5 06:10:49 CET 2008


Author: neal.norwitz
Date: Wed Mar  5 06:10:48 2008
New Revision: 61241

Modified:
   python/trunk/Lib/bsddb/test/test_dbshelve.py
   python/trunk/Lib/bsddb/test/test_thread.py
Log:
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson.  Also simplified removing a file by using test_support.


Modified: python/trunk/Lib/bsddb/test/test_dbshelve.py
==============================================================================
--- python/trunk/Lib/bsddb/test/test_dbshelve.py	(original)
+++ python/trunk/Lib/bsddb/test/test_dbshelve.py	Wed Mar  5 06:10:48 2008
@@ -40,10 +40,7 @@
 
     def tearDown(self):
         self.do_close()
-        try:
-            os.remove(self.filename)
-        except os.error:
-            pass
+        test_support.unlink(self.filename)
 
     def mk(self, key):
         """Turn key into an appropriate key type for this db"""
@@ -267,8 +264,8 @@
 
 
     def tearDown(self):
-        test_support.rmtree(self.homeDir)
         self.do_close()
+        test_support.rmtree(self.homeDir)
 
 
 class EnvBTreeShelveTestCase(BasicEnvShelveTestCase):

Modified: python/trunk/Lib/bsddb/test/test_thread.py
==============================================================================
--- python/trunk/Lib/bsddb/test/test_thread.py	(original)
+++ python/trunk/Lib/bsddb/test/test_thread.py	Wed Mar  5 06:10:48 2008
@@ -73,9 +73,9 @@
         self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
 
     def tearDown(self):
-        test_support.rmtree(self.homeDir)
         self.d.close()
         self.env.close()
+        test_support.rmtree(self.homeDir)
 
     def setEnvOpts(self):
         pass


More information about the Python-checkins mailing list