summaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.py')
-rw-r--r--test/test.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/test.py b/test/test.py
index fbbdcf4..6886c1f 100644
--- a/test/test.py
+++ b/test/test.py
@@ -14,6 +14,7 @@ import glob
14import sys 14import sys
15import tempfile 15import tempfile
16import unittest 16import unittest
17import subprocess
17 18
18VERBOSITY = 15 19VERBOSITY = 15
19 20
@@ -27,6 +28,7 @@ FILE_LIST = zip(clean, dirty)
27try: # PDF render processing 28try: # PDF render processing
28 import cairo 29 import cairo
29 import gi 30 import gi
31
30 gi.require_version('Poppler', '0.18') 32 gi.require_version('Poppler', '0.18')
31 from gi.repository import Poppler 33 from gi.repository import Poppler
32 import pdfrw 34 import pdfrw
@@ -42,9 +44,10 @@ except ImportError:
42 44
43try: # exiftool 45try: # exiftool
44 subprocess.check_output(['exiftool', '-ver']) 46 subprocess.check_output(['exiftool', '-ver'])
45except: 47except OSError:
46 FILE_LIST.remove(('clean é.tif', 'dirty é.tif')) 48 FILE_LIST.remove(('clean é.tif', 'dirty é.tif'))
47 49
50
48class MATTest(unittest.TestCase): 51class MATTest(unittest.TestCase):
49 """ 52 """
50 Parent class of all test-functions 53 Parent class of all test-functions
@@ -84,26 +87,28 @@ def run_all_tests():
84 """ 87 """
85 import clitest 88 import clitest
86 import libtest 89 import libtest
87 SUITE = unittest.TestSuite() 90 suite = unittest.TestSuite()
88 SUITE.addTests(clitest.get_tests()) 91 suite.addTests(clitest.get_tests())
89 SUITE.addTests(libtest.get_tests()) 92 suite.addTests(libtest.get_tests())
93
94 return unittest.TextTestRunner(verbosity=VERBOSITY).run(suite).wasSuccessful()
90 95
91 return unittest.TextTestRunner(verbosity=VERBOSITY).run(SUITE).wasSuccessful()
92 96
93def set_local(): 97def set_local():
94 ''' Monkey patch pathes to run the testsuite on the _local_ 98 """ Monkey patch pathes to run the testsuite on the _local_
95 version of MAT. See `run_all_tests` for more information about 99 version of MAT. See `run_all_tests` for more information about
96 what pathes we're changing and why. 100 what pathes we're changing and why.
97 ''' 101 """
98 os.environ['PATH'] = '..:' + os.environ['PATH'] 102 os.environ['PATH'] = '..:' + os.environ['PATH']
99 sys.path.append('..') 103 sys.path.append('..')
100 104
105
101if __name__ == '__main__': 106if __name__ == '__main__':
102 import argparse 107 import argparse
103 108
104 parser = argparse.ArgumentParser(description='MAT testsuite') 109 parser = argparse.ArgumentParser(description='MAT testsuite')
105 parser.add_argument('-s', '--system', action='store_true', 110 parser.add_argument('-s', '--system', action='store_true',
106 help='Test the system-wide version of mat') 111 help='Test the system-wide version of mat')
107 112
108 if parser.parse_args().system is False: 113 if parser.parse_args().system is False:
109 set_local() 114 set_local()