From b49ea7dc02270cfcc94d101d03857c6e5df94532 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 24 Jul 2011 21:30:10 +0200 Subject: Now the test suite use tempfile (wasn't working at all since now, sorry about that) --- test/test.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'test/test.py') 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): Create working copy of the clean and the dirty file in the TMP dir ''' self.file_list = [] - _, self.tmpdir = tempfile.mkstemp() + self.tmpdir = tempfile.mkdtemp() 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)) + shutil.copy2(clean, self.tmpdir + os.sep + clean) + shutil.copy2(dirty, self.tmpdir + os.sep + dirty) + + self.file_list.append((self.tmpdir + os.sep + clean, + self.tmpdir + os.sep + 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] + for clean, dirty in self.file_list: + mat.secure_remove(clean) + mat.secure_remove(dirty) + shutil.rmtree(self.tmpdir) -- cgit v1.3