summaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
authorjvoisin2011-07-24 21:30:10 +0200
committerjvoisin2011-07-24 21:30:10 +0200
commitb49ea7dc02270cfcc94d101d03857c6e5df94532 (patch)
treec3d0b47a95a97dffadef25217d09b1179b016e58 /test/test.py
parentace3d8213921a9308d30afc057fc21221420e12e (diff)
Now the test suite use tempfile (wasn't working at all since now, sorry about that)
Diffstat (limited to 'test/test.py')
-rw-r--r--test/test.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/test.py b/test/test.py
index 39672c6..e9e8f82 100644
--- a/test/test.py
+++ b/test/test.py
@@ -23,17 +23,20 @@ class MATTest(unittest.TestCase):
23 Create working copy of the clean and the dirty file in the TMP dir 23 Create working copy of the clean and the dirty file in the TMP dir
24 ''' 24 '''
25 self.file_list = [] 25 self.file_list = []
26 _, self.tmpdir = tempfile.mkstemp() 26 self.tmpdir = tempfile.mkdtemp()
27 27
28 for clean, dirty in FILE_LIST: 28 for clean, dirty in FILE_LIST:
29 shutil.copy2(clean, self.tmpdir + clean) 29 shutil.copy2(clean, self.tmpdir + os.sep + clean)
30 shutil.copy2(dirty, self.tmpdir + dirty) 30 shutil.copy2(dirty, self.tmpdir + os.sep + dirty)
31 self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty)) 31
32 self.file_list.append((self.tmpdir + os.sep + clean,
33 self.tmpdir + os.sep + dirty))
32 34
33 def tearDown(self): 35 def tearDown(self):
34 ''' 36 '''
35 Remove the tmp folder 37 Remove the tmp folder
36 ''' 38 '''
37 for root, dirs, files in os.walk(self.tmpdir, topdown=False): 39 for clean, dirty in self.file_list:
38 [mat.secure_remove(os.path.join(toor, name)) for name in files] 40 mat.secure_remove(clean)
39 [os.rmdir(os.path.join(root, name)) for name in dirs] 41 mat.secure_remove(dirty)
42 shutil.rmtree(self.tmpdir)