summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_cursor_pget_bug.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/bsddb/test/test_cursor_pget_bug.py')
-rw-r--r--Lib/bsddb/test/test_cursor_pget_bug.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/bsddb/test/test_cursor_pget_bug.py b/Lib/bsddb/test/test_cursor_pget_bug.py
index ac60cb4..2af12bf 100644
--- a/Lib/bsddb/test/test_cursor_pget_bug.py
+++ b/Lib/bsddb/test/test_cursor_pget_bug.py
@@ -1,5 +1,7 @@
import unittest
import sys, os, glob
+import shutil
+import tempfile
from bsddb import db
@@ -11,11 +13,7 @@ class pget_bugTestCase(unittest.TestCase):
db_name = 'test-cursor_pget.db'
def setUp(self):
- self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home')
- try:
- os.mkdir(self.homeDir)
- except os.error:
- pass
+ self.homeDir = tempfile.mkdtemp()
self.env = db.DBEnv()
self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
self.primary_db = db.DB(self.env)
@@ -36,9 +34,7 @@ class pget_bugTestCase(unittest.TestCase):
del self.secondary_db
del self.primary_db
del self.env
- for file in glob.glob(os.path.join(self.homeDir, '*')):
- os.remove(file)
- os.removedirs(self.homeDir)
+ shutil.rmtree(self.homeDir)
def test_pget(self):
cursor = self.secondary_db.cursor()