summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_basics.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/bsddb/test/test_basics.py')
-rw-r--r--Lib/bsddb/test/test_basics.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/Lib/bsddb/test/test_basics.py b/Lib/bsddb/test/test_basics.py
index 6d0fff1..af82cd1 100644
--- a/Lib/bsddb/test/test_basics.py
+++ b/Lib/bsddb/test/test_basics.py
@@ -5,10 +5,10 @@ various DB flags, etc.
import os
import errno
-import shutil
import string
import tempfile
from pprint import pprint
+from test import test_support
import unittest
import time
@@ -53,13 +53,9 @@ class BasicTestCase(unittest.TestCase):
def setUp(self):
if self.useEnv:
- homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
+ homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid())
self.homeDir = homeDir
- try:
- shutil.rmtree(homeDir)
- except OSError, e:
- # unix returns ENOENT, windows returns ESRCH
- if e.errno not in (errno.ENOENT, errno.ESRCH): raise
+ test_support.rmtree(homeDir)
os.mkdir(homeDir)
try:
self.env = db.DBEnv()
@@ -73,7 +69,7 @@ class BasicTestCase(unittest.TestCase):
tempfile.tempdir = None
# Yes, a bare except is intended, since we're re-raising the exc.
except:
- shutil.rmtree(homeDir)
+ test_support.rmtree(homeDir)
raise
else:
self.env = None
@@ -97,8 +93,8 @@ class BasicTestCase(unittest.TestCase):
def tearDown(self):
self.d.close()
if self.env is not None:
+ test_support.rmtree(self.homeDir)
self.env.close()
- shutil.rmtree(self.homeDir)
## Make a new DBEnv to remove the env files from the home dir.
## (It can't be done while the env is open, nor after it has been
## closed, so we make a new one to do it.)