diff options
| -rw-r--r-- | tests/test_climat2.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 61f342b..4a46644 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | import random | ||
| 1 | import os | 2 | import os |
| 2 | import shutil | 3 | import shutil |
| 3 | import subprocess | 4 | import subprocess |
| @@ -217,6 +218,24 @@ class TestCommandLineParallel(unittest.TestCase): | |||
| 217 | self.assertIsNotNone(p) | 218 | self.assertIsNotNone(p) |
| 218 | p = parser_factory.get_parser(p.output_filename) | 219 | p = parser_factory.get_parser(p.output_filename) |
| 219 | self.assertEqual(p.get_meta(), {}) | 220 | self.assertEqual(p.get_meta(), {}) |
| 220 | print('DELET: %s' % i) | ||
| 221 | shutil.rmtree('./tests/data/parallel') | 221 | shutil.rmtree('./tests/data/parallel') |
| 222 | 222 | ||
| 223 | def test_faulty(self): | ||
| 224 | for i in range(self.iterations): | ||
| 225 | shutil.copy('./tests/data/dirty.jpg', './tests/data/dirty_%d.jpg' % i) | ||
| 226 | shutil.copy('./tests/data/dirty.torrent', './tests/data/dirty_%d.docx' % i) | ||
| 227 | |||
| 228 | to_process = ['./tests/data/dirty_%d.jpg' % i for i in range(self.iterations)] | ||
| 229 | to_process.extend(['./tests/data/dirty_%d.docx' % i for i in range(self.iterations)]) | ||
| 230 | random.shuffle(to_process) | ||
| 231 | proc = subprocess.Popen(mat2_binary + to_process, | ||
| 232 | stdout=subprocess.PIPE) | ||
| 233 | stdout, _ = proc.communicate() | ||
| 234 | |||
| 235 | for i in range(self.iterations): | ||
| 236 | path = './tests/data/dirty_%d.jpg' % i | ||
| 237 | p = images.JPGParser('./tests/data/dirty_%d.cleaned.jpg' % i) | ||
| 238 | self.assertEqual(p.get_meta(), {}) | ||
| 239 | os.remove('./tests/data/dirty_%d.cleaned.jpg' % i) | ||
| 240 | os.remove(path) | ||
| 241 | os.remove('./tests/data/dirty_%d.docx' % i) | ||
