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:
parent
a79c9410af
commit
d2b2a54a72
2 changed files with 28 additions and 30 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue