1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

Fix #130: Use temporary directory for unit tests.

This commit is contained in:
William Ting 2012-06-10 20:50:18 -10:00
parent 3a7f211fb6
commit f29876b202

View File

@ -27,6 +27,7 @@ def no_stderr():
class TestAutojump(unittest.TestCase):
def setUp(self):
autojump.CONFIG_DIR = tempfile.mkdtemp()
autojump.TESTING = True
self.fd, self.fname = tempfile.mkstemp()
self.db = autojump.Database(self.fname)
@ -37,6 +38,9 @@ class TestAutojump(unittest.TestCase):
os.remove(self.fname)
if os.path.isfile(self.fname + ".bak"):
os.remove(self.fname + ".bak")
if (os.path.exists(autojump.CONFIG_DIR) and
('tmp' in autojump.CONFIG_DIR or 'temp' in autojump.CONFIG_DIR)):
shutil.rmtree(autojump.CONFIG_DIR)
def test_config(self):
self.assertEqual(autojump.COMPLETION_SEPARATOR, '__')