From 5b9c600ae96e63f1f7a7f9487512c3c9d8a356e7 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 5 Oct 2015 21:43:17 +0200 Subject: Tests can now target system-wide or global MAT $ python test.py --local/--system --- test/libtest.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/libtest.py') diff --git a/test/libtest.py b/test/libtest.py index 25d7426..03ae4a1 100644 --- a/test/libtest.py +++ b/test/libtest.py @@ -10,10 +10,14 @@ import sys import shutil import tarfile import tempfile -import test import unittest -sys.path.append('..') +import test +if test.IS_LOCAL is True: + # Are we testing the _local_ version of MAT? + sys.path.insert(0, '..') +# else it will be in the path + import libmat @@ -155,12 +159,12 @@ class TestArchiveProcessing(test.MATTest): """ tarpath = os.path.join(self.tmpdir, "test.tar.bz2") tar = tarfile.open(tarpath, "w") - for f in ('../mat.desktop', '../README.security', '../setup.py'): - tar.add(f, f[3:]) # trim '../' + for f in ('libtest.py', 'test.py', 'clitest.py'): + tar.add(f, f) tar.close() current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) unsupported_files = set(current_file.is_clean(list_unsupported=True)) - self.assertEqual(unsupported_files, {'mat.desktop', 'README.security', 'setup.py'}) + self.assertEqual(unsupported_files, {'libtest.py', 'test.py', 'clitest.py'}) def test_archive_unwritable_content(self): path = os.path.join(self.tmpdir, './unwritable_content.zip') -- cgit v1.3