Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document testing framework #432

Closed
jayfk opened this issue Aug 9, 2016 · 11 comments
Closed

Document testing framework #432

jayfk opened this issue Aug 9, 2016 · 11 comments

Comments

@jayfk
Copy link
Contributor

jayfk commented Aug 9, 2016

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

Currently, there is no straightforward documentation for it.

@jakirkham
Copy link

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.

@jakirkham
Copy link

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.

@jakirkham
Copy link

xref: #254 (comment) ?

@sfdye
Copy link
Member

sfdye commented Mar 21, 2018

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

@jakirkham
Copy link

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

@sfdye
Copy link
Member

sfdye commented Mar 21, 2018

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

@iliapolo
Copy link

@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

@sfdye
Copy link
Member

sfdye commented May 25, 2018

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

@stale
Copy link

stale bot commented Jul 24, 2018

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.

@stale stale bot added the stale label Jul 24, 2018
@stale stale bot closed this as completed Jul 31, 2018
@edthrn
Copy link

edthrn commented Aug 31, 2018

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...

@ChaiBapchya
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants