diff options
Diffstat (limited to 'test/test.py')
| -rw-r--r-- | test/test.py | 17 |
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) | ||
