From 3d785e2c6a0ceeb83747cf46b509cd1c81e689ca Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Sat, 26 Jan 2008 23:14:17 +0000 Subject: [PATCH] Consistently use tempfile.tempdir for the db_home directory. --- Lib/bsddb/test/test_associate.py | 2 +- Lib/bsddb/test/test_compare.py | 3 ++- Lib/bsddb/test/test_cursor_pget_bug.py | 3 ++- Lib/bsddb/test/test_pickle.py | 3 ++- Lib/bsddb/test/test_sequence.py | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Lib/bsddb/test/test_associate.py b/Lib/bsddb/test/test_associate.py index ff10cd75f4f..fd70c5d4a08 100644 --- a/Lib/bsddb/test/test_associate.py +++ b/Lib/bsddb/test/test_associate.py @@ -151,7 +151,7 @@ class AssociateTestCase(unittest.TestCase): def setUp(self): self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') + homeDir = os.path.join(tempfile.gettempdir(), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) diff --git a/Lib/bsddb/test/test_compare.py b/Lib/bsddb/test/test_compare.py index 59a45ec502a..5aa830869b3 100644 --- a/Lib/bsddb/test/test_compare.py +++ b/Lib/bsddb/test/test_compare.py @@ -4,6 +4,7 @@ TestCases for python DB Btree key comparison function. import sys, os, re import test_all +import tempfile from cStringIO import StringIO import unittest @@ -51,7 +52,7 @@ class AbstractBtreeKeyCompareTestCase (unittest.TestCase): def setUp (self): self.filename = self.__class__.__name__ + '.db' - homeDir = os.path.join (os.path.dirname (sys.argv[0]), 'db_home') + homeDir = os.path.join (tempfile.gettempdir(), 'db_home') self.homeDir = homeDir try: os.mkdir (homeDir) diff --git a/Lib/bsddb/test/test_cursor_pget_bug.py b/Lib/bsddb/test/test_cursor_pget_bug.py index de47e6d0463..2f72b1155b2 100644 --- a/Lib/bsddb/test/test_cursor_pget_bug.py +++ b/Lib/bsddb/test/test_cursor_pget_bug.py @@ -1,4 +1,5 @@ import unittest +import tempfile import sys, os, glob try: @@ -16,7 +17,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') + self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home') try: os.mkdir(self.homeDir) except os.error: diff --git a/Lib/bsddb/test/test_pickle.py b/Lib/bsddb/test/test_pickle.py index 3916e5cb9e6..ef84a4097f8 100644 --- a/Lib/bsddb/test/test_pickle.py +++ b/Lib/bsddb/test/test_pickle.py @@ -6,6 +6,7 @@ try: except ImportError: cPickle = None import unittest +import tempfile import glob try: @@ -24,7 +25,7 @@ class pickleTestCase(unittest.TestCase): db_name = 'test-dbobj.db' def setUp(self): - homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') + homeDir = os.path.join(tempfile.gettempdir(), 'db_home') self.homeDir = homeDir try: os.mkdir(homeDir) except os.error: pass diff --git a/Lib/bsddb/test/test_sequence.py b/Lib/bsddb/test/test_sequence.py index 979f858c4a0..239e8ee13fa 100644 --- a/Lib/bsddb/test/test_sequence.py +++ b/Lib/bsddb/test/test_sequence.py @@ -16,7 +16,7 @@ from test_all import verbose class DBSequenceTest(unittest.TestCase): def setUp(self): self.int_32_max = 0x100000000 - self.homeDir = os.path.join(os.path.dirname(sys.argv[0]), 'db_home') + self.homeDir = os.path.join(tempfile.gettempdir(), 'db_home') try: os.mkdir(self.homeDir) except os.error: