]> granicus.if.org Git - python/commitdiff
Remove the files/dirs after closing the DB so the tests work on Windows.
authorNeal Norwitz <nnorwitz@gmail.com>
Wed, 5 Mar 2008 05:10:48 +0000 (05:10 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Wed, 5 Mar 2008 05:10:48 +0000 (05:10 +0000)
Patch from Trent Nelson.  Also simplified removing a file by using test_support.

Lib/bsddb/test/test_dbshelve.py
Lib/bsddb/test/test_thread.py

index 21070856bda70a0a9be400587a5a2e34f4a5a84e..752ebc33afc0aee0ccdaa3bc41083c621d9caa7b 100644 (file)
@@ -40,10 +40,7 @@ class DBShelveTestCase(unittest.TestCase):
 
     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 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
 
 
     def tearDown(self):
-        test_support.rmtree(self.homeDir)
         self.do_close()
+        test_support.rmtree(self.homeDir)
 
 
 class EnvBTreeShelveTestCase(BasicEnvShelveTestCase):
index 15ed9056dc607af820a6a7560682f455a9b1ab49..0395f6d0814106fd3c094c018038f1c1f337a3ad 100644 (file)
@@ -73,9 +73,9 @@ class BaseThreadedTestCase(unittest.TestCase):
         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