-
Notifications
You must be signed in to change notification settings - Fork 107
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
Replace unittest
with pytest
in cli tests and document endstate
#874
Conversation
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
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.
I don't seem to see any of the updated places needing mocker
at all. Everything can be implemented with the built-in monkeypatch.setattr()
and monkeypatch.setenv()
.
I was hoping you might bring attention to this. In #872 , we suggest the use of Based on the #872 I went directly for I think this finding might merit documentation somewhere, that we prefer the use of monkeypatch over pytest-mock where it can be used, which I should have suggested in #872 but didn't think of it at the time. I will add an issue related to that so it can be added to the upcoming developer guide when it arrives. I will also make the changes, because I agree, no need to pull in pytest-mock until it is needed. |
I think it may be useful when replacing the decorators or needing to automatically and implicitly use magic mocks or spy on things. But none of the diff changes I see included right now use that. |
Totally agreed. None of https://docs.pytest.org/en/latest/how-to/monkeypatch.html / https://pypi.org/p/pytest-mock have this comparison in their documentation. Having some sort of dos and don'ts could be useful. |
unittest.mock
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.
unittest.mock
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.unittest.mock
to pytests
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.
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.
Please try to follow the famous 72/50 rule, that PR title spreading on 3 lines in browser is not easy to read, on git log
would even be worse.
From personal experience be sure that the editor you use to write commit message is able to display 72/50 markers, as this helps. I use Fork.app on macos, but also code is able to display guidelines for these.
unittest.mock
to pytests
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.unittest.mock
to pytest
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.
unittest.mock
to pytest
in several tests; adding, correcting docstrings to help reviewers better understand what each function and file touched does.unittest
with pytest
in gs h f
unittest
with pytest
in gs h funittest
with pytest
in cli tests, documenting endstate
unittest
with pytest
in cli tests, documenting endstateunittest
with pytest
in cli tests and document endstate
Good stuff here about that for me, since I have chosen to use vscode.... https://robertcooper.me/post/git-commit-messages#using-vscode-to-write-commit-messages |
Yep, I know some people use set VS Code as their default Git editor. You may also like the possibility to configure a commit template — https://codeinthehole.com/tips/a-useful-template-for-commit-messages/. P.S. Here's some inspiration on how to craft great commit messages: https://twitter.com/nedbat/status/1283147492616556544. |
@cidrblock #896 this may be helpful to keep yourself in check. Note that it only checks the last commit. Try it out, though. |
Approved but I will take the opportunity to mention that I have mixed feelings about thin kind of move. I remember people on openstack being actively opposed to pytest being a walled garden for testing and use of its own implementation limiting the options. Is not really a problem for us as we use only pytest everywhere, but I would avoid bothering about switching stuff unless they are broken. If it still works with older approach, why bother? (no need to answer). |
No need, but I am compelled. I want to explain how this played out, so future contributors don't get put in a similar situation.
Because many developers look at the current code base to reuse pieces of code when adding to it, I wanted to make sure these got converted to pytest tests so they can serve as valid examples in the future. I also wanted the experience of doing the conversion and the learning about pytest that came with it. When mixed messages from 2 repository owners fall on the shoulders of a contributor to sort out and weigh, they might find it frustrating and be led to believe the team does not have one voice. Please help me make sure this doesn't happen again, let's all try to stay in sync better, including me with both of you. |
This is follow on work from #872 which guarded against the use of unittest.