blob: 39672c6ef2b7b63cde13875ef7af8e23767ef717 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
'''
Class for the testing suite :
- get the list of all test files
- create a copy of them on start
- remove the copy on end
'''
import shutil
import os
import glob
import sys
import tempfile
import unittest
sys.path.append('..')
from lib import mat
FILE_LIST = zip(glob.glob('clean*'), glob.glob('dirty*'))
class MATTest(unittest.TestCase):
def setUp(self):
'''
Create working copy of the clean and the dirty file in the TMP dir
'''
self.file_list = []
_, self.tmpdir = tempfile.mkstemp()
for clean, dirty in FILE_LIST:
shutil.copy2(clean, self.tmpdir + clean)
shutil.copy2(dirty, self.tmpdir + dirty)
self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty))
def tearDown(self):
'''
Remove the tmp folder
'''
for root, dirs, files in os.walk(self.tmpdir, topdown=False):
[mat.secure_remove(os.path.join(toor, name)) for name in files]
[os.rmdir(os.path.join(root, name)) for name in dirs]
|