-
Notifications
You must be signed in to change notification settings - Fork 671
Refactor: split unit tests by API resources #1078
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall so far!
I'm also biased against classes in python. See also the last sentence of the Zen of Python
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>>
3cbafae
to
f1ebb88
Compare
😁 that's great I'm glad, I was afraid these changes would be too much. I've only left the 2 classes in I realized I might be getting myself into a continuous rebase party as new PR's with tests in the old files are merged, so I've cleaned it up a bit more and I think I want to look at fixtures in a later PR when I have more time, if this is in an OK shape? |
@nejch Sorry totally missed this. Does one only see assignments and not reviewers in the feed? |
@nejch I would love to merge this. Could you please rebase to latest master? |
f1ebb88
to
9edf10f
Compare
9edf10f
to
204782a
Compare
Sorry @max-wittig I'm back from the dead/vacation/other distractions now 😁 I've rebased and rewritten the tests using responses now so it's more consistent with your runners example. Could you have another look to see if this is how you imagined Not sure about notifications, there's a separate Notification setting for PR Reviews so maybe you had them turned off? |
We actually have less tests with this MR. I guess some got lost. Could yout take a look? @nejch 155 vs. 158 This MR: https://travis-ci.org/github/python-gitlab/python-gitlab/jobs/720445167 |
Oof, I was weirded out by this until I realized that on master, 2 test cases (in With master:
refactor:
|
Thank you very much! Very nice! |
I've been thinking about how to make testing more accessible for contributors and maybe splitting them by resources in the Gitlab API docs would be best because that's how most people interact with this anyway. If there's a new API resource it likely gets a new page so this would kind of make it a 1-to-1 for new contributions.
Ideas:
Figure out a better way for fixtures & mocking copy/pasting