summaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.py')
-rw-r--r--test/test.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/test/test.py b/test/test.py
index ed68e13..40cbf0c 100644
--- a/test/test.py
+++ b/test/test.py
@@ -1,13 +1,12 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# -*- coding: utf-8 -* 2# -*- coding: utf-8 -*
3 3
4''' 4"""
5 Class for the testing suite : 5 Class for the testing suite :
6 - get the list of all test files 6 - get the list of all test files
7 - create a copy of them on start 7 - create a copy of them on start
8 - remove the copy on end 8 - remove the copy on end
9''' 9"""
10
11 10
12import shutil 11import shutil
13import os 12import os
@@ -42,27 +41,28 @@ except ImportError:
42 41
43 42
44class MATTest(unittest.TestCase): 43class MATTest(unittest.TestCase):
45 ''' 44 """
46 Parent class of all test-functions 45 Parent class of all test-functions
47 ''' 46 """
47
48 def setUp(self): 48 def setUp(self):
49 ''' 49 """
50 Create working copy of the clean and the dirty file in the TMP dir 50 Create working copy of the clean and the dirty file in the TMP dir
51 ''' 51 """
52 self.file_list = [] 52 self.file_list = []
53 self.tmpdir = tempfile.mkdtemp() 53 self.tmpdir = tempfile.mkdtemp()
54 54
55 for clean, dirty in FILE_LIST: 55 for clean_file, dirty_file in FILE_LIST:
56 clean_dir = os.path.join(self.tmpdir, clean) 56 clean_dir = os.path.join(self.tmpdir, clean_file)
57 dirty_dir = os.path.join(self.tmpdir, dirty) 57 dirty_dir = os.path.join(self.tmpdir, dirty_file)
58 shutil.copy2(clean, clean_dir) 58 shutil.copy2(clean_file, clean_dir)
59 shutil.copy2(dirty, dirty_dir) 59 shutil.copy2(dirty_file, dirty_dir)
60 self.file_list.append((clean_dir, dirty_dir)) 60 self.file_list.append((clean_dir, dirty_dir))
61 61
62 def tearDown(self): 62 def tearDown(self):
63 ''' 63 """
64 Remove the tmp folder 64 Remove the tmp folder
65 ''' 65 """
66 for root, dirs, files in os.walk(self.tmpdir): 66 for root, dirs, files in os.walk(self.tmpdir):
67 for d in dirs + files: 67 for d in dirs + files:
68 os.chmod(os.path.join(root, d), 0o777) 68 os.chmod(os.path.join(root, d), 0o777)
@@ -78,4 +78,4 @@ if __name__ == '__main__':
78 SUITE.addTests(libtest.get_tests()) 78 SUITE.addTests(libtest.get_tests())
79 79
80 ret = unittest.TextTestRunner(verbosity=VERBOSITY).run(SUITE).wasSuccessful() 80 ret = unittest.TextTestRunner(verbosity=VERBOSITY).run(SUITE).wasSuccessful()
81 sys.exit(ret == False) 81 sys.exit(ret is False)