summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2018-04-29 22:55:26 +0200
committerjvoisin2018-04-29 22:59:23 +0200
commitd2b2a54a724db89447027e44ecb8f9bbed72cb83 (patch)
treeff68c16e9157c40d915b38769da5b31eac7080e2 /tests
parenta79c9410afbd81a7e2f40ea59cdcef2b36a4ad2f (diff)
MAT2's cli now uses meaningful return codes
- Simplify the multiprocessing by using a Pool - Use some functional (♥) constructions to exit with a return code - Add some tests to prove that we're doing things that are working correctly
Diffstat (limited to 'tests')
-rw-r--r--tests/test_climat2.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index 0536646..bc4a175 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -16,6 +16,22 @@ class TestHelp(unittest.TestCase):
16 self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) 16 self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout)
17 17
18 18
19class TestReturnValue(unittest.TestCase):
20 def test_nonzero(self):
21 ret = subprocess.call(['./main.py', './main.py'], stdout=subprocess.DEVNULL)
22 self.assertEqual(255, ret)
23
24 ret = subprocess.call(['./main.py', '--whololo'], stderr=subprocess.DEVNULL)
25 self.assertEqual(2, ret)
26
27 def test_zero(self):
28 ret = subprocess.call(['./main.py'], stdout=subprocess.DEVNULL)
29 self.assertEqual(0, ret)
30
31 ret = subprocess.call(['./main.py', '--show', './main.py'], stdout=subprocess.DEVNULL)
32 self.assertEqual(0, ret)
33
34
19class TestCleanMeta(unittest.TestCase): 35class TestCleanMeta(unittest.TestCase):
20 def test_jpg(self): 36 def test_jpg(self):
21 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') 37 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')