summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjvoisin2015-12-30 17:15:23 +0100
committerjvoisin2015-12-30 17:15:23 +0100
commit3696b59badfef2438a3df1755868b2aeeb443b87 (patch)
treea2cc0035c2397ac5bb043b3fa9711f6bd3585923 /test
parent3ac3f353c64d406aa2fa46c5c9841346408e1e01 (diff)
Fix some pep8-related issues
Diffstat (limited to 'test')
-rw-r--r--test/clitest.py4
-rw-r--r--test/test.py21
2 files changed, 16 insertions, 9 deletions
diff --git a/test/clitest.py b/test/clitest.py
index e186531..884655f 100644
--- a/test/clitest.py
+++ b/test/clitest.py
@@ -136,10 +136,11 @@ class TestUnsupported(test.MATTest):
136 tar.close() 136 tar.close()
137 proc = subprocess.Popen(['mat', tarpath], stdout=subprocess.PIPE) 137 proc = subprocess.Popen(['mat', tarpath], stdout=subprocess.PIPE)
138 stdout, _ = proc.communicate() 138 stdout, _ = proc.communicate()
139 self.assertTrue('It contains unsupported filetypes:' \ 139 self.assertTrue('It contains unsupported filetypes:'
140 '\n- libtest.py\n- test.py\n- clitest.py\n' 140 '\n- libtest.py\n- test.py\n- clitest.py\n'
141 in str(stdout)) 141 in str(stdout))
142 142
143
143class TestHelp(test.MATTest): 144class TestHelp(test.MATTest):
144 """ Test the different ways to trigger help """ 145 """ Test the different ways to trigger help """
145 def test_dash_h(self): 146 def test_dash_h(self):
@@ -164,6 +165,7 @@ class TestHelp(test.MATTest):
164 _, stderr = proc.communicate() 165 _, stderr = proc.communicate()
165 self.assertTrue(('usage: mat [-h]' and ' error: unrecognized arguments:') in stderr) 166 self.assertTrue(('usage: mat [-h]' and ' error: unrecognized arguments:') in stderr)
166 167
168
167def get_tests(): 169def get_tests():
168 """ Return every clitests""" 170 """ Return every clitests"""
169 suite = unittest.TestSuite() 171 suite = unittest.TestSuite()
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()