From f29876b202a2e4a024f62a03ea95cc9fbce48e98 Mon Sep 17 00:00:00 2001 From: William Ting Date: Sun, 10 Jun 2012 20:50:18 -1000 Subject: [PATCH] Fix #130: Use temporary directory for unit tests. --- tests/runtests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/runtests.py b/tests/runtests.py index e36f47b..6c65272 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -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, '__')