mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
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)
This commit is contained in:
parent
d97110dd1b
commit
afed3a4552
2 changed files with 18 additions and 19 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue