From c037e265c61f710ce0a54cc51b7e2e9ba8486e46 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 14 May 2018 22:44:31 +0200 Subject: Add a `--version` option --- tests/test_climat2.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/test_climat2.py') diff --git a/tests/test_climat2.py b/tests/test_climat2.py index 44703b7..67b56eb 100644 --- a/tests/test_climat2.py +++ b/tests/test_climat2.py @@ -8,12 +8,20 @@ class TestHelp(unittest.TestCase): def test_help(self): proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE) stdout, _ = proc.communicate() - self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) + self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) def test_no_arg(self): proc = subprocess.Popen(['./main.py'], stdout=subprocess.PIPE) stdout, _ = proc.communicate() - self.assertIn(b'usage: main.py [-h] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) + self.assertIn(b'usage: main.py [-h] [-v] [-c] [-l] [-s] [-L] [files [files ...]]', stdout) + + +class TestVersion(unittest.TestCase): + def test_version(self): + proc = subprocess.Popen(['./main.py', '--version'], stdout=subprocess.PIPE) + stdout, _ = proc.communicate() + self.assertTrue(stdout.startswith(b'MAT2 ')) + class TestReturnValue(unittest.TestCase): -- cgit v1.3