How to write unit tests for GitPython clone/pull functions?
问题 I have a python project that is using GitPython to perform clone and pull functions against a remote Git repository. As a simple example: import git from git import Git from git import Repo def clone_and_checkout(full_dir, git_url, repo_ver): repo = Repo.clone_from( url=git_url, to_path=full_dir ) # Trigger re-create if repository is bare if repo.bare: raise git.exc.InvalidGitRepositoryError # Set origin and pull origin = repo.remotes.origin origin.pull() # Check out desired version of