-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Warn when no specs are used #21
Comments
I agree, but I don't think it's the job of pytest-mock to fix this up. I plan to write a pylint plugin for this some day, to statically check mocks are always used with I wonder, is there a better mocking library (i.e. with a more sane API) which could be exposed to pytest? |
There is none, generally mocking is tricky and a sign of bad structure I wouldn't want to invent one |
What do you suggest exactly? If one uses |
Yes |
Fair enough. 😄 I don't want current users to suddenly start to receive warnings for valid uses of the API though, so I'm thinking of making this an [pytest]
mock_warnings = yes # defaults to no @RonnyPfannschmidt, @The-Compiler, what do you guys think? |
👍 |
Thankful I found this issue. I'm new to mocking and I was wondering why the test wasn't failing when a mock was called more than once. I had mocked_function = mocker.patch('app.function')
do_something()
mocked_function.called_once() The test passed even though After I added +1 for the Even an update to the docs would be very helpful |
Mock without specs is so forgiving that people often write tests whose asserts do nothing
This is mainly because the apu of mock is severely flawed and error-prone
The text was updated successfully, but these errors were encountered: