Consider different possibilities for tmpdir.
authorIvan Alejandro <ivanalejandro0@gmail.com>
Mon, 12 Jan 2015 20:13:05 +0000 (17:13 -0300)
committerIvan Alejandro <ivanalejandro0@gmail.com>
Wed, 21 Jan 2015 16:03:44 +0000 (13:03 -0300)
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.

changes/bug_tempdir-alternatives [new file with mode: 0644]
src/leap/common/testing/basetest.py

diff --git a/changes/bug_tempdir-alternatives b/changes/bug_tempdir-alternatives
new file mode 100644 (file)
index 0000000..579d880
--- /dev/null
@@ -0,0 +1 @@
+- Consider different possibilities for tmpdir. Related to #6631.
index 3c6fc29..efaedc3 100644 (file)
@@ -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!")