diff options
| author | jvoisin | 2014-01-02 18:09:23 +0000 |
|---|---|---|
| committer | jvoisin | 2014-01-02 18:09:23 +0000 |
| commit | 721e42cdce7b03c089720a406a54654a8f379d43 (patch) | |
| tree | 5c9d0cb0a6ce171e644553ae7ba2b158226bdbcd /test | |
| parent | d7006310e015eced664446853ebaaacee286f3f1 (diff) | |
Fix a stupid test
Diffstat (limited to 'test')
| -rw-r--r-- | test/libtest.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/libtest.py b/test/libtest.py index 633e97d..e869381 100644 --- a/test/libtest.py +++ b/test/libtest.py | |||
| @@ -5,11 +5,12 @@ | |||
| 5 | Unit test for the library | 5 | Unit test for the library |
| 6 | ''' | 6 | ''' |
| 7 | 7 | ||
| 8 | import unittest | 8 | import os |
| 9 | import test | ||
| 10 | import sys | 9 | import sys |
| 11 | import tempfile | ||
| 12 | import tarfile | 10 | import tarfile |
| 11 | import tempfile | ||
| 12 | import test | ||
| 13 | import unittest | ||
| 13 | 14 | ||
| 14 | sys.path.append('..') | 15 | sys.path.append('..') |
| 15 | import MAT | 16 | import MAT |
| @@ -105,23 +106,25 @@ class TestArchiveProcessing(test.MATTest): | |||
| 105 | ''' Test archives cleaning | 106 | ''' Test archives cleaning |
| 106 | ''' | 107 | ''' |
| 107 | def test_remove_bz2(self): | 108 | def test_remove_bz2(self): |
| 108 | tar = tarfile.open("test.tar.bz2", "w:bz2") | 109 | tarpath = os.path.join(self.tmpdir, "test.tar.bz2") |
| 110 | tar = tarfile.open(tarpath, "w:bz2") | ||
| 109 | for _,dirty in self.file_list: | 111 | for _,dirty in self.file_list: |
| 110 | tar.add(dirty) | 112 | tar.add(dirty) |
| 111 | tar.close() | 113 | tar.close() |
| 112 | current_file = MAT.mat.create_class_file("test.tar.bz2", False, add2archive=False) | 114 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) |
| 113 | current_file.remove_all() | 115 | current_file.remove_all() |
| 114 | current_file = MAT.mat.create_class_file("test.tar.bz2", False, add2archive=False) | 116 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) |
| 115 | self.assertTrue(current_file.is_clean()) | 117 | self.assertTrue(current_file.is_clean()) |
| 116 | 118 | ||
| 117 | def test_remove_tar(self): | 119 | def test_remove_tar(self): |
| 118 | tar = tarfile.open("test.tar", "w") | 120 | tarpath = os.path.join(self.tmpdir, "test.tar") |
| 121 | tar = tarfile.open(tarpath, "w") | ||
| 119 | for _,dirty in self.file_list: | 122 | for _,dirty in self.file_list: |
| 120 | tar.add(dirty) | 123 | tar.add(dirty) |
| 121 | tar.close() | 124 | tar.close() |
| 122 | current_file = MAT.mat.create_class_file("test.tar", False, add2archive=False) | 125 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) |
| 123 | current_file.remove_all() | 126 | current_file.remove_all() |
| 124 | current_file = MAT.mat.create_class_file("test.tar", False, add2archive=False) | 127 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) |
| 125 | self.assertTrue(current_file.is_clean()) | 128 | self.assertTrue(current_file.is_clean()) |
| 126 | 129 | ||
| 127 | def get_tests(): | 130 | def get_tests(): |
