1
0
Fork 0

Adding upstream version 0.15.7.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-11 18:44:17 +01:00
parent d8a18b006a
commit 6204f01115
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
10 changed files with 324 additions and 206 deletions

View file

@ -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):