summaryrefslogtreecommitdiffstats
path: root/Lib/bsddb/test/test_recno.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_recno.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_recno.py')
-rw-r--r--Lib/bsddb/test/test_recno.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/bsddb/test/test_recno.py b/Lib/bsddb/test/test_recno.py
index 25482d5..1ebaf79 100644
--- a/Lib/bsddb/test/test_recno.py
+++ b/Lib/bsddb/test/test_recno.py
@@ -2,13 +2,14 @@
"""
import os
+import shutil
import sys
import errno
import tempfile
from pprint import pprint
import unittest
-from .test_all import verbose
+from bsddb.test.test_all import verbose
try:
# For Pythons w/distutils pybsddb
@@ -25,12 +26,14 @@ letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
class SimpleRecnoTestCase(unittest.TestCase):
def setUp(self):
self.filename = tempfile.mktemp()
+ self.homeDir = tempfile.mkdtemp()
def tearDown(self):
try:
os.remove(self.filename)
except OSError as e:
if e.errno != errno.EEXIST: raise
+ shutil.rmtree(self.homeDir)
def test01_basic(self):
d = db.DB()
@@ -203,10 +206,7 @@ class SimpleRecnoTestCase(unittest.TestCase):
just a line in the file, but you can set a different record delimiter
if needed.
"""
- homeDir = os.path.join(tempfile.gettempdir(), 'db_home')
- source = os.path.join(homeDir, 'test_recno.txt')
- if not os.path.isdir(homeDir):
- os.mkdir(homeDir)
+ source = os.path.join(self.homeDir, 'test_recno.txt')
f = open(source, 'w') # create the file
f.close()