Skip to content

Commit e00d5c5

Browse files
authored
fix unit tests using git remotes
1 parent 2d8339b commit e00d5c5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test_builds.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def setup_commit_history(testproject_path):
148148
testproject_path = str(testproject_path)
149149

150150
repo = git.Repo.init(testproject_path, bare=False)
151+
repo.git.checkout("-b", "master")
151152
author = "Test Person <[email protected]>"
152153

153154

@@ -618,18 +619,18 @@ def test_low_fetch_depth(tmp_path, caplog):
618619
# Clone the local repo with fetch depth of 1
619620
repo = git.Repo.init(cloned_folder, bare=False)
620621
try:
621-
repo.heads.main.rename("main", force=True)
622+
repo.heads.main.rename("master", force=True)
622623
except:
623624
pass
624625
origin = repo.create_remote("origin", str(testproject_path))
625-
origin.fetch(refspec="refs/heads/main:refs/heads/origin", depth=1, prune=True)
626+
origin.fetch(depth=1, prune=True)
626627
repo.create_head(
627-
"main", origin.refs.main
628+
"master", origin.refs.master
628629
) # create local branch "master" from remote "master"
629-
repo.heads.main.set_tracking_branch(
630-
origin.refs.main
630+
repo.heads.master.set_tracking_branch(
631+
origin.refs.master
631632
) # set local "master" to track remote "master
632-
repo.heads.main.checkout() # checkout local "master" to working tree
633+
repo.heads.master.checkout() # checkout local "master" to working tree
633634

634635
# should not raise warning
635636
result = build_docs_setup(cloned_folder)

0 commit comments

Comments
 (0)