diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_wrapper.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index e574946b..61636b26 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py | |||
@@ -26,6 +26,14 @@ from pyversion import is_python3 | |||
26 | import wrapper | 26 | import wrapper |
27 | 27 | ||
28 | 28 | ||
29 | if is_python3(): | ||
30 | from unittest import mock | ||
31 | from io import StringIO | ||
32 | else: | ||
33 | import mock | ||
34 | from StringIO import StringIO | ||
35 | |||
36 | |||
29 | def fixture(*paths): | 37 | def fixture(*paths): |
30 | """Return a path relative to tests/fixtures. | 38 | """Return a path relative to tests/fixtures. |
31 | """ | 39 | """ |
@@ -48,6 +56,16 @@ class RepoWrapperUnitTest(RepoWrapperTestCase): | |||
48 | """Tests helper functions in the repo wrapper | 56 | """Tests helper functions in the repo wrapper |
49 | """ | 57 | """ |
50 | 58 | ||
59 | def test_version(self): | ||
60 | """Make sure _Version works.""" | ||
61 | with self.assertRaises(SystemExit) as e: | ||
62 | with mock.patch('sys.stdout', new_callable=StringIO) as stdout: | ||
63 | with mock.patch('sys.stderr', new_callable=StringIO) as stderr: | ||
64 | self.wrapper._Version() | ||
65 | self.assertEqual(0, e.exception.code) | ||
66 | self.assertEqual('', stderr.getvalue()) | ||
67 | self.assertIn('repo launcher version', stdout.getvalue()) | ||
68 | |||
51 | def test_get_gitc_manifest_dir_no_gitc(self): | 69 | def test_get_gitc_manifest_dir_no_gitc(self): |
52 | """ | 70 | """ |
53 | Test reading a missing gitc config file | 71 | Test reading a missing gitc config file |