diff options
Diffstat (limited to 'Lib/bsddb/test/test_recno.py')
-rw-r--r-- | Lib/bsddb/test/test_recno.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/bsddb/test/test_recno.py b/Lib/bsddb/test/test_recno.py index e001b63..dc15ad1 100644 --- a/Lib/bsddb/test/test_recno.py +++ b/Lib/bsddb/test/test_recno.py @@ -26,14 +26,13 @@ letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' class SimpleRecnoTestCase(unittest.TestCase): def setUp(self): self.filename = tempfile.mktemp() - self.homeDir = tempfile.mkdtemp() + self.homeDir = None def tearDown(self): - try: - os.remove(self.filename) - except OSError as e: - if e.errno != errno.EEXIST: raise - shutil.rmtree(self.homeDir) + from test import test_support + test_support.unlink(self.filename) + if self.homeDir: + test_support.rmtree(self.homeDir) def test01_basic(self): d = db.DB() @@ -206,7 +205,11 @@ class SimpleRecnoTestCase(unittest.TestCase): just a line in the file, but you can set a different record delimiter if needed. """ - source = os.path.join(self.homeDir, 'test_recno.txt') + homeDir = os.path.join(tempfile.gettempdir(), 'db_home%d'%os.getpid()) + self.homeDir = homeDir + source = os.path.join(homeDir, 'test_recno.txt') + if not os.path.isdir(homeDir): + os.mkdir(homeDir) f = open(source, 'w') # create the file f.close() |