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.
This commit is contained in:
parent
d21fb4c2e0
commit
31e88934ed
|
@ -40,10 +40,7 @@ class DBShelveTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.do_close()
|
self.do_close()
|
||||||
try:
|
test_support.unlink(self.filename)
|
||||||
os.remove(self.filename)
|
|
||||||
except os.error:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def mk(self, key):
|
def mk(self, key):
|
||||||
"""Turn key into an appropriate key type for this db"""
|
"""Turn key into an appropriate key type for this db"""
|
||||||
|
@ -267,8 +264,8 @@ class BasicEnvShelveTestCase(DBShelveTestCase):
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
test_support.rmtree(self.homeDir)
|
|
||||||
self.do_close()
|
self.do_close()
|
||||||
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
|
|
||||||
class EnvBTreeShelveTestCase(BasicEnvShelveTestCase):
|
class EnvBTreeShelveTestCase(BasicEnvShelveTestCase):
|
||||||
|
|
|
@ -73,9 +73,9 @@ class BaseThreadedTestCase(unittest.TestCase):
|
||||||
self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
|
self.d.open(self.filename, self.dbtype, self.dbopenflags|db.DB_CREATE)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
test_support.rmtree(self.homeDir)
|
|
||||||
self.d.close()
|
self.d.close()
|
||||||
self.env.close()
|
self.env.close()
|
||||||
|
test_support.rmtree(self.homeDir)
|
||||||
|
|
||||||
def setEnvOpts(self):
|
def setEnvOpts(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue