diff options
Diffstat (limited to 'test/test.py')
| -rwxr-xr-x | test/test.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test.py b/test/test.py new file mode 100755 index 0000000..f095157 --- /dev/null +++ b/test/test.py | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | ''' | ||
| 2 | Class for the testing suite : | ||
| 3 | - get the list of all test files | ||
| 4 | - create a copy of them on start | ||
| 5 | - remove the copy on end | ||
| 6 | ''' | ||
| 7 | |||
| 8 | import shutil | ||
| 9 | import glob | ||
| 10 | import sys | ||
| 11 | import tempfile | ||
| 12 | import unittest | ||
| 13 | sys.path.append('..') | ||
| 14 | from lib import mat | ||
| 15 | |||
| 16 | FILE_LIST = zip(glob.glob('clean*'), glob.glob('dirty*')) | ||
| 17 | |||
| 18 | class MATTest(unittest.TestCase): | ||
| 19 | def setUp(self): | ||
| 20 | '''create working copy of the clean and the dirty file in the TMP dir''' | ||
| 21 | self.file_list = [] | ||
| 22 | self.tmpdir = tempfile.mkdtemp() | ||
| 23 | |||
| 24 | for clean, dirty in FILE_LIST: | ||
| 25 | shutil.copy2(clean, self.tmpdir + clean) | ||
| 26 | shutil.copy2(dirty, self.tmpdir + dirty) | ||
| 27 | self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty)) | ||
| 28 | |||
| 29 | def tearDown(self): | ||
| 30 | '''Remove the tmp folder''' | ||
| 31 | shutil.rmtree(self.tmpdir) | ||
