-
Notifications
You must be signed in to change notification settings - Fork 106
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
expand doesn't work with mock.patch.multiple #138
Comments
Hey! I'm not able to reproduce this issue; tests with But please feel free to re-open this issue or create a PR if there's something I've missed! |
Hey, @wolever thanks for looking into it! There's a couple of ways this can still break actually:
For example, if I tweak the test class as below, then I get the error:
Whereas the equivalent non-multiple patches as below work correctly.
|
Ah thank you! I'll drop in a fix this weekend, or feel free to open a PR with test! |
No worries! I could probably drop a PR this weekend if you want. Sadly unable to do it during work time |
Wow, that's a weird one! It seems like the class-level This fix will be part of the 0.9 release, which should be out by the time you read this. Thanks for taking the time to submit a report! |
Fix #138: support for class-level mock.patch.multiple
Hah! Thanks for the fix :) |
When using mock.patch.multiple as a decorator (class or test method), the mocks it creates are passed in as keyword arguments to the test function.
Unfortunately, this is not compatible with
expand
, as the standalone functions that it generates (parameterized.parameterized.param_as_standalone_func.standalone_func
) only take unnamed positional arguments.The simplest fix seems to be to just add unnamed keyword arguments as well:
The text was updated successfully, but these errors were encountered: