From 78b78410a461d433a0d84d30de25f3b155c21836 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Wed, 12 Jul 2023 23:09:09 +0100 Subject: [PATCH] test: specify default git branch don't assume that master is the default branch name. Signed-off-by: Caleb Connolly Reviewed-by: Oliver Smith Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230629-suffix-type-hint-v1-3-e92802ae20a8@postmarketos.org%3E --- test/pmb_test/git.py | 8 ++++---- test/test_helpers_git.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/pmb_test/git.py b/test/pmb_test/git.py index bd06ffe5..7f1fe8c5 100644 --- a/test/pmb_test/git.py +++ b/test/pmb_test/git.py @@ -35,16 +35,16 @@ def prepare_tmpdir(args, monkeypatch, tmpdir): def run_git(git_args, repo="local"): path = tmpdir + "/" + repo - pmb.helpers.run.user(args, ["git"] + git_args, path, "stdout") + pmb.helpers.run.user(args, ["git"] + git_args, path, "stdout", output_return=True) # Remote repos - run_git(["init", "."], "remote") + run_git(["init", "-b", "master", "."], "remote") run_git(["commit", "--allow-empty", "-m", "commit: remote"], "remote") - run_git(["init", "."], "remote2") + run_git(["init", "-b", "master", "."], "remote2") run_git(["commit", "--allow-empty", "-m", "commit: remote2"], "remote2") # Local repo (with master -> origin2/master) - run_git(["init", "."]) + run_git(["init", "-b", "master", "."]) run_git(["remote", "add", "-f", "origin", path_remote]) run_git(["remote", "add", "-f", "origin2", path_remote2]) run_git(["checkout", "-b", "master", "--track", "origin2/master"]) diff --git a/test/test_helpers_git.py b/test/test_helpers_git.py index 05a66738..3f5488d3 100644 --- a/test/test_helpers_git.py +++ b/test/test_helpers_git.py @@ -44,7 +44,7 @@ def test_can_fast_forward(args, tmpdir): pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout") # Create test git repo - run_git(["init", "."]) + run_git(["init", "-b", "master", "."]) run_git(["commit", "--allow-empty", "-m", "commit on master"]) run_git(["checkout", "-b", branch_origin]) run_git(["commit", "--allow-empty", "-m", "commit on branch_origin"]) @@ -71,7 +71,7 @@ def test_clean_worktree(args, tmpdir): pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout") # Create test git repo - run_git(["init", "."]) + run_git(["init", "-b", "master", "."]) run_git(["commit", "--allow-empty", "-m", "commit on master"]) assert func(args, tmpdir) is True @@ -98,7 +98,7 @@ def test_get_upstream_remote(args, monkeypatch, tmpdir): pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout") # Create git repo - run_git(["init", "."]) + run_git(["init", "-b", "master", "."]) run_git(["commit", "--allow-empty", "-m", "commit on master"]) # No upstream remote