PyGithub is a library for interacting with the GitHub API; it will not let you clone your repository or otherwise interact with a local git repository.
GitPython is a Python interface to git and can be used to clone a remote repository. In fact, there's an example of exactly that at the beginning of the tutorial to which you have linked.
That said, it's not clear from your question exactly what you hope to accomplish -- learning the git commandline interface is an important skill if you're going to be working with GitHub (or git in general). While you can probably perform many of the same tasks with GitPython, you are arguably going to be spending much of your time duplicating the existing functionality of the commandline tools.
Videos
» pip install PyGithub
I am using the python library pygithub to automatically create new branches and pull requests when certain files are updated. However, I am not sure how I would go about writing unit tests for this. I have a function that creates the branch and one that makes the pull request. I have tried looking at the pygithub tests for inspiration but I wasn't able to gain insight.
This would be very easy to test if I could simply allow pull requests and branches to be made, but I want to see if there is a way to do this without actually creating them. I looked into mocking objects, but I couldn't see how I that would actually be a real test since I am basically telling the objects what to do anyway.
How should I approach this problem? Is mocking even the right approach, or do I really need to create the branches and pull requests and delete them after?