summaryrefslogtreecommitdiff
path: root/test/libtest.py
diff options
context:
space:
mode:
authorjvoisin2014-01-02 18:09:23 +0000
committerjvoisin2014-01-02 18:09:23 +0000
commit721e42cdce7b03c089720a406a54654a8f379d43 (patch)
tree5c9d0cb0a6ce171e644553ae7ba2b158226bdbcd /test/libtest.py
parentd7006310e015eced664446853ebaaacee286f3f1 (diff)
Fix a stupid test
Diffstat (limited to '')
-rw-r--r--test/libtest.py21
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
8import unittest 8import os
9import test
10import sys 9import sys
11import tempfile
12import tarfile 10import tarfile
11import tempfile
12import test
13import unittest
13 14
14sys.path.append('..') 15sys.path.append('..')
15import MAT 16import 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
127def get_tests(): 130def get_tests():