1
0
Fork 0
mirror of synced 2025-07-04 04:17:29 +02:00

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
This commit is contained in:
jvoisin 2018-04-29 22:55:26 +02:00
parent a79c9410af
commit d2b2a54a72
2 changed files with 28 additions and 30 deletions

View file

@ -16,6 +16,22 @@ class TestHelp(unittest.TestCase):
self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout)
class TestReturnValue(unittest.TestCase):
def test_nonzero(self):
ret = subprocess.call(['./main.py', './main.py'], stdout=subprocess.DEVNULL)
self.assertEqual(255, ret)
ret = subprocess.call(['./main.py', '--whololo'], stderr=subprocess.DEVNULL)
self.assertEqual(2, ret)
def test_zero(self):
ret = subprocess.call(['./main.py'], stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
ret = subprocess.call(['./main.py', '--show', './main.py'], stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
class TestCleanMeta(unittest.TestCase):
def test_jpg(self):
shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')