Pygithub: Document testing framework

Created on 9 Aug 2016  路  11Comments  路  Source: PyGithub/PyGithub

PyGithub comes with it's own testing framework that allows to record and replay requests.

Currently, there is no straightforward documentation for it.

good first issue stale

Most helpful comment

Just FYI, to whom is reading this, I've spent 4h trying to figure out how the testing framework works, but couldn't manage to crack it all...

I decided to move on, and hacked a quick solution. This is probably not the best, but at least it does the job temporarily...

All 11 comments

Honestly that would be amazing. We were discussing in another project how to improve our test suite. Right now we are tied to testing with a GitHub token and real GitHub objects. It would be much better if we could use mock objects and not call GitHub's API at all (or very little at least). We were just wondering how you are doing testing (as we use PyGithub heavily) and wondered if there were things we could learn from your approach.

Should also add there are tons of PRs without tests. Maybe this is naive on my part, but I would think there would be many more PRs with tests if people understood how they worked.

Still true today, took me a while to understand the testing framework

Any thoughts on writing up something about what you learned about the testing framework? ;)

@jakirkham Maybe in a bit, when I have some free time.

@sfdye I recently wrote a library that also relies heavily on PyGithub.

I took the time to learn the testing framework and extracted an isolated class that can be used to record and replay. I specifically use it inside py.test suites, not unittest.

Is it possible for me to release such a class as a library on PyPI? I mean license wise. And if so, would you like to have a look?

@jakirkham fyi

@iliapolo I did not author the original test framework, but I guess that should be fine, since PyGithub is LGPL.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Just FYI, to whom is reading this, I've spent 4h trying to figure out how the testing framework works, but couldn't manage to crack it all...

I decided to move on, and hacked a quick solution. This is probably not the best, but at least it does the job temporarily...

@jayfk @sfdye since this documentation is pending since 2016 & many folks have requested it. Can you atleast point to how users can mock pygithub API tests? Framework.py file doesn't cut it... It'd be really helpful if we could get documentation or a working example of how to mock Github APIs in python.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RitamDey picture RitamDey  路  13Comments

JosephTLyons picture JosephTLyons  路  43Comments

sfdye picture sfdye  路  9Comments

thefunkjunky picture thefunkjunky  路  11Comments

lost-a-tooth picture lost-a-tooth  路  17Comments