diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-09 15:00:25 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2020-02-12 20:54:50 +0000 |
commit | 8ddff5c74f533f4f125c957d7bd063452c59f0db (patch) | |
tree | 43122badb2576ba8b81b431bd6da4761879d6cc9 /tests | |
parent | 8409410aa294cad68bf93679726e0a4465e1fe2b (diff) | |
download | git-repo-8ddff5c74f533f4f125c957d7bd063452c59f0db.tar.gz |
repo: add --version support to the launcher
We can get version info when in a checkout, but it'd be helpful
to show that info at all times.
Change-Id: Ieeb44a503c9d7d8c487db4810bdcf3d5f6656c82
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254712
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
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 |