I am currently working with a project where I am using gitpython to check a few things in git repositories. I have now started to write tests for my project, and by doing so, I have realized I need to mock a few things.
In this project I am making git.Repo classes by cloning repositories as well as using local repositories. I could run these tests locally, on my computer, but it will not be possible to assume that the tests will work on other computers.
Essentially, the question is, how do I mock repositories in gitpython? How can I "pretend" that a repository exists on a specified path on the current computer?
You can see what needs to be mocked below:
import git
repository = git.Repo('./local_repo_path')