From 8cbea5731e9eb8a54ff9a58daeaa3db5ab51dee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Val=C3=AD=C4=8Dek?= Date: Wed, 27 Jul 2022 13:37:32 +0200 Subject: [PATCH] Fixed failing test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Valíček --- tests/_support_data/test-repo-changed-branches | 2 +- tests/lib/test_repo_tool.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/_support_data/test-repo-changed-branches b/tests/_support_data/test-repo-changed-branches index 2cd8137..3254380 160000 --- a/tests/_support_data/test-repo-changed-branches +++ b/tests/_support_data/test-repo-changed-branches @@ -1 +1 @@ -Subproject commit 2cd8137eeb96e2d23169d5728e9071b0ed663677 +Subproject commit 3254380703607d4f632688e8ac8b3eec1eb69397 diff --git a/tests/lib/test_repo_tool.py b/tests/lib/test_repo_tool.py index 364871b..ab42c5c 100644 --- a/tests/lib/test_repo_tool.py +++ b/tests/lib/test_repo_tool.py @@ -28,7 +28,6 @@ base_repo_branches = [ ('release/7.7.8', '85003adc6bc0e91391edd97efb7f515cbd6d303e'), ('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'), ('symlink-readme', '8a2844f55fc1adde2e346d0999ef3e12aafbe511'), - ('temp', '72cab056e6a95fbb4e7ea3f0e1644a7eef345a2d'), ('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'), ('v1/nix', 'c55e6953ff343f9eeb42dc04eb6aa5dfed6f0756')] @@ -209,15 +208,20 @@ def cloned_base_repo_obj(tmp_path: Path, path_repo_base: Path) -> RepoTool: def prepare_collection_list(collection) -> list: result = [] + items = {} for item in collection: - result.append((item.name, str(item.commit))) - result.sort() + items[item.name] = str(item.commit) + keys = list(items.keys()) + keys.sort() + for key in list(keys): + result.append((key, str(items[key]))) return result def test_fetch_changed_branches(cloned_base_repo_obj: RepoTool, path_repo_changed_branches: Path): cloned_base_repo_obj._repo.remotes[0].set_url(path_repo_changed_branches.as_uri()) branches = prepare_collection_list(cloned_base_repo_obj._repo.branches) + assert branches == base_repo_branches tags = prepare_collection_list(cloned_base_repo_obj._repo.tags) @@ -247,7 +251,7 @@ def test_fetch_changed_branches(cloned_base_repo_obj: RepoTool, path_repo_change ('release/7.7.9', '73aaf9a4377bab721ba716776e81dc76bec25beb'), ('v1/foo/bar', '6e3325f7dc37f67b48e719de1ce4a4c9d33d1042'), ('v1/nix', '64ab804caa81c6a1c302cc03c3671d80f767c2c9'), - ('wut', '558f12143c6d6d60690acb291cf64a863e12c2d0')] + ('wut', '3254380703607d4f632688e8ac8b3eec1eb69397')] tags = prepare_collection_list(cloned_base_repo_obj._repo.tags) assert tags == [ @@ -276,6 +280,8 @@ def test_fetch_diferent_tags(cloned_base_repo_obj: RepoTool, path_repo_different assert cloned_base_repo_obj.fetch() + print(branches) + branches = prepare_collection_list(cloned_base_repo_obj._repo.branches) assert branches == [ ('br0', '1fe320fe278a40bfd6813860d9952b03caf5e2ea'),