@mocketize as TestCase class decorator #297
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One nice thing you can do in httpretty is:
And then you don't need to do it for every single test method. Code in httpretty that handles this is here: https://github.com/gabrielfalcao/HTTPretty/blob/f9f012711597634d40066d144a36888b3addcc46/httpretty/core.py#L2066
Totally understand if this is a patch you would prefer not to accept, it probably feels a little "invasive" to mocket's core functionality. I'm happy to maintain a patch that works for me in my codebase.
(as with the previous PRs, this change is motivated by the httpretty->mocket migration i'm currently doing where we use the class level decorator quite heavily)
One annoying thing about the
@httpretty.activate
implementation is that you can't do@httpretty.activate(allow_net_connect=False)
with the class decorator version. But with this PR you can do@mocketize(strict_mode=True)
.But as I said, I have no issue at all if you'd prefer to close this PR without merging :)