diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2007-10-18 07:56:54 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2007-10-18 07:56:54 (GMT) |
commit | afed3a4552e0df61477c322f60b10d3ae59edf1c (patch) | |
tree | d1ecd46b98122ba4a6b788986106efd98386078a /Lib/bsddb/test | |
parent | d97110dd1bdc9a82a9191627c638cffa8118bc80 (diff) | |
download | cpython-afed3a4552e0df61477c322f60b10d3ae59edf1c.zip cpython-afed3a4552e0df61477c322f60b10d3ae59edf1c.tar.gz cpython-afed3a4552e0df61477c322f60b10d3ae59edf1c.tar.bz2 |
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
Diffstat (limited to 'Lib/bsddb/test')
-rw-r--r-- | Lib/bsddb/test/test_dbtables.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/bsddb/test/test_dbtables.py b/Lib/bsddb/test/test_dbtables.py index 959565c..3a401e3 100644 --- a/Lib/bsddb/test/test_dbtables.py +++ b/Lib/bsddb/test/test_dbtables.py @@ -21,6 +21,8 @@ # $Id$ import sys, os, re +import tempfile +import shutil try: import cPickle pickle = cPickle @@ -47,8 +49,8 @@ class TableDBTestCase(unittest.TestCase): db_name = 'test-table.db' def setUp(self): - homeDir = os.path.join(tempfile.gettempdir(), 'db_home') - self.homeDir = homeDir + homeDir = tempfile.mkdtemp() + self.testHomeDir = homeDir try: os.mkdir(homeDir) except os.error: pass self.tdb = dbtables.bsdTableDB( @@ -56,10 +58,7 @@ class TableDBTestCase(unittest.TestCase): def tearDown(self): self.tdb.close() - import glob - files = glob.glob(os.path.join(self.homeDir, '*')) - for file in files: - os.remove(file) + shutil.rmtree(self.testHomeDir) def test01(self): tabname = "test01" |