diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:05:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-09-06 04:05:34 +0000 |
commit | 2a5c4df5436696d8656c0a630dcaf1dea9e828ea (patch) | |
tree | 83f406ee5035fc5c284274699943ed5fccc6a852 /tests/test_utils.py | |
parent | Adding upstream version 0.15.2. (diff) | |
download | gita-2a5c4df5436696d8656c0a630dcaf1dea9e828ea.tar.xz gita-2a5c4df5436696d8656c0a630dcaf1dea9e828ea.zip |
Adding upstream version 0.15.7.upstream/0.15.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 39430b0..3ff0cb1 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -11,7 +11,7 @@ from conftest import ( @pytest.mark.parametrize('repo_path, paths, expected', [ - ('/a/b/c/repo', ['/a/b'], ('b', 'c')), + ('/a/b/c/repo', ['/a/b'], (('b', 'c'), '/a')), ]) def test_generate_dir_hash(repo_path, paths, expected): got = utils._generate_dir_hash(repo_path, paths) @@ -20,11 +20,13 @@ def test_generate_dir_hash(repo_path, paths, expected): @pytest.mark.parametrize('repos, paths, expected', [ ({'r1': {'path': '/a/b//repo1'}, 'r2': {'path': '/a/b/repo2'}}, - ['/a/b'], {'b': ['r1', 'r2']}), + ['/a/b'], {'b': {'repos': ['r1', 'r2'], 'path': '/a/b'}}), ({'r1': {'path': '/a/b//repo1'}, 'r2': {'path': '/a/b/c/repo2'}}, - ['/a/b'], {'b': ['r1', 'r2'], 'b-c': ['r2']}), + ['/a/b'], {'b': {'repos': ['r1', 'r2'], 'path': '/a/b'}, + 'b-c': {'repos': ['r2'], 'path': "/a/b/c"}}), ({'r1': {'path': '/a/b/c/repo1'}, 'r2': {'path': '/a/b/c/repo2'}}, - ['/a/b'], {'b-c': ['r1', 'r2'], 'b': ['r1', 'r2']}), + ['/a/b'], {'b-c': {'repos': ['r1', 'r2'], 'path': '/a/b/c'}, + 'b': {'path': '/a/b', 'repos': ['r1', 'r2']}}), ]) def test_auto_group(repos, paths, expected): got = utils.auto_group(repos, paths) @@ -46,8 +48,8 @@ def test_describe(test_input, diff_return, expected, monkeypatch): monkeypatch.setattr(info, 'get_commit_time', lambda *_: "xx") monkeypatch.setattr(info, 'has_untracked', lambda *_: True) monkeypatch.setattr('os.chdir', lambda x: None) - print('expected: ', repr(expected)) - print('got: ', repr(next(utils.describe(*test_input)))) + + info.get_color_encoding.cache_clear() # avoid side effect assert expected == next(utils.describe(*test_input)) @@ -83,7 +85,8 @@ def test_get_context(mock_config_dir): @pytest.mark.parametrize('group_fname, expected', [ - (GROUP_FNAME, {'xx': ['a', 'b'], 'yy': ['a', 'c', 'd']}), + (GROUP_FNAME, {'xx': {'repos': ['a', 'b'], 'path': ''}, + 'yy': {'repos': ['a', 'c', 'd'], 'path': ''}}), ]) @patch('gita.common.get_config_fname') def test_get_groups(mock_group_fname, group_fname, expected): |