From 6ef20e16abb80ea0f265a35b7ecdbb38fb29298c Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 12 Jan 2015 17:13:05 -0300 Subject: Consider different possibilities for tmpdir. In some systems the used tmp dir is like '/tmp/leap_tests-asdf' and in others is like '/tmp/username/leap_tests-asdf'. With this fix we protect the home dir and consider different possible temp directories. --- src/leap/common/testing/basetest.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/leap/common') diff --git a/src/leap/common/testing/basetest.py b/src/leap/common/testing/basetest.py index 3c6fc29..efaedc3 100644 --- a/src/leap/common/testing/basetest.py +++ b/src/leap/common/testing/basetest.py @@ -77,6 +77,9 @@ class BaseLeapTest(unittest.TestCase): # XXX needs to adapt to non-linuces leap_assert( cls.tempdir.startswith('/tmp/leap_tests-') or + (cls.tempdir.startswith('/tmp/') and + cls.tempdir.startswith(tempfile.gettempdir()) and + 'leap_tests-' in cls.tempdir) or cls.tempdir.startswith('/var/folder'), "beware! tried to remove a dir which does not " "live in temporal folder!") -- cgit v1.2.3