summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_env_close.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_env_close.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_env_close.py')
-rw-r--r--Lib/bsddb/test/test_env_close.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/bsddb/test/test_env_close.py b/Lib/bsddb/test/test_env_close.py
index 1a6a804..2ef5867 100644
--- a/Lib/bsddb/test/test_env_close.py
+++ b/Lib/bsddb/test/test_env_close.py
@@ -3,6 +3,7 @@ is closed before its DB objects.
"""
import os
+import shutil
import sys
import tempfile
import glob
@@ -15,7 +16,7 @@ except ImportError:
# For Python 2.3
from bsddb import db
-from .test_all import verbose
+from bsddb.test.test_all import verbose
# We're going to get warnings in this module about trying to close the db when
# its env is already closed. Let's just ignore those.
@@ -33,17 +34,14 @@ else:
class DBEnvClosedEarlyCrash(unittest.TestCase):
def setUp(self):
- self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
- try: os.mkdir(self.homeDir)
- except os.error: pass
+ self.homeDir = tempfile.mkdtemp()
+ old_tempfile_tempdir = tempfile.tempdir
tempfile.tempdir = self.homeDir
self.filename = os.path.split(tempfile.mktemp())[1]
- tempfile.tempdir = None
+ tempfile.tempdir = old_tempfile_tempdir
def tearDown(self):
- files = glob.glob(os.path.join(self.homeDir, '*'))
- for file in files:
- os.remove(file)
+ shutil.rmtree(self.homeDir)
def test01_close_dbenv_before_db(self):