summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_misc.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2007-08-28 08:05:56 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2007-08-28 08:05:56 (GMT)
commit3fd22da6129040fdea850bf593e63fc8c333304b (patch)
treec7ce98ab685a138c745048f0314c9007b9d99996 /Lib/bsddb/test/test_misc.py
parenta280ca759492360fd7440476f513fa9726d22bff (diff)
downloadcpython-3fd22da6129040fdea850bf593e63fc8c333304b.zip
cpython-3fd22da6129040fdea850bf593e63fc8c333304b.tar.gz
cpython-3fd22da6129040fdea850bf593e63fc8c333304b.tar.bz2
some test suite cleanup, use tempfile.mkdtemp() in setUp and
shutil.rmtree() in tearDown(). add missing tests to the list in the test_bsddb3 suite.
Diffstat (limited to 'Lib/bsddb/test/test_misc.py')
-rw-r--r--Lib/bsddb/test/test_misc.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/Lib/bsddb/test/test_misc.py b/Lib/bsddb/test/test_misc.py
index 6b2df07..15098b7 100644
--- a/Lib/bsddb/test/test_misc.py
+++ b/Lib/bsddb/test/test_misc.py
@@ -2,6 +2,7 @@
"""
import os
+import shutil
import sys
import unittest
import tempfile
@@ -18,22 +19,14 @@ except ImportError:
class MiscTestCase(unittest.TestCase):
def setUp(self):
self.filename = self.__class__.__name__ + '.db'
- homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
- self.homeDir = homeDir
- try:
- os.mkdir(homeDir)
- except OSError:
- pass
+ self.homeDir = tempfile.mkdtemp()
def tearDown(self):
try:
os.remove(self.filename)
except OSError:
pass
- import glob
- files = glob.glob(os.path.join(self.homeDir, '*'))
- for file in files:
- os.remove(file)
+ shutil.rmtree(self.homeDir)
def test01_badpointer(self):
dbs = dbshelve.open(self.filename)