-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add param to disable verify over non-requested mock. #76
Conversation
Kudos, SonarCloud Quality Gate passed! |
Thanks for the proposal @Bernardoow , could you please give more details on the test case itself and why you would need to mock something that is not called by your code ? |
Hi @Colin-b, I usually use a parametrize. So, I put two codes that one call and another not. I put this option to allow developers to choose the away to check about the called. I tried to 'override' the fixture inside of the test but it not worked. In another tests I want the behavior that raise exception when the mock isnot called. |
Hi @Bernardoow, I had a similar need. I think this also solves your case in which for some tests you want the assert and in other tests you don't. And you can also parameterise that. |
@Colin-b Hi, Do you have plans to merge this PR? In my case, we use |
I don't think we'll move forward with this implementation proposal. However I acknowledge the need to be able to have the Right now, you could achieve this by using a separate file with a different fixture value in each file. Or you could even do as proposed by @citrusLover with the downside being that if your test case fail before reaching the call to reset, you will not be in a state that you want. A cleaner solution would be to have a marker that you could set on the test case itself allowing to set @artofhuman I don't think your concern is related to this pull request, unless I am mistaken you want your cache to be cleared in between test cases. That is not a problematic linked to pytest-httpx, but rather the way you setup your cache to be reset from one test to another. You would have the same issue if you were using real queries in your test suite no? |
As I have no responses on this, I'll close it. A new issue (#137) was opened to introduce decorators instead of fixtures to address your need of different httpx settings in the same test file. Because if you are already using different test files, you can already set this up using fixtures. |
I had a scenario where I wanted to all request to be verified about over non-request, but just ONE request I wanted to be free verification.
With this new feature I can achieve this logic.