-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
bpo-41877: Check for misspelled speccing arguments #23737
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
Conversation
patch, patch.object and create_autospec silently ignore misspelled arguments such as autospect, auto_spec and set_spec. This can lead to tests failing to check what they are supposed to check. This change adds a check causing a RuntimeError if the above functions get any of the above misspellings as arguments. It also adds a new argument, "unsafe", which can be set to True to disable this check.
Also revert changes forced by `unsafe` being positional, and add "!r" to format specifiers in added error messages.
Thanks for the first review round! |
Also revert changes forced by `unsafe` being positional, and add "!r" to format specifiers in added error messages.
…on into issue-41877-arguments-check
I was looking at the failing test_asyncio on Win x64, but it does not seem related. There are no uses of autospec in Lib/test/test_asyncio/test_sendfile.py as far as I can tell, and the issue is weirdly platform-specific. |
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.
all my remaining comments are minor
patch, patch.object and create_autospec silently ignore misspelled arguments such as autospect, auto_spec and set_spec. This can lead to tests failing to check what they are supposed to check. This change adds a check causing a RuntimeError if the above functions get any of the above misspellings as arguments. It also adds a new argument, "unsafe", which can be set to True to disable this check. Also add "!r" to format specifiers in added error messages.
Some clean up have been done in py3.10 [1] and implemented in [2]. So, we caught this typo while building package on Fedora with python3.10. With 'autospec' instead of 'auto_spec' unit tests fail. As 'autospec' was silently ignored, and in order to keep same behavior, we remove the parameter. [1] https://bugs.python.org/issue41877 [2] python/cpython#23737 Change-Id: I092d48b9806c4cd6f8b2ecbedd7ab5b7c6d20c04
* Update openstacksdk from branch 'master' to 5ff2a9291665b2ad02d0d0b553a7f92381f6fb3f - Merge "Remove misspelled speccing arguments" - Remove misspelled speccing arguments Some clean up have been done in py3.10 [1] and implemented in [2]. So, we caught this typo while building package on Fedora with python3.10. With 'autospec' instead of 'auto_spec' unit tests fail. As 'autospec' was silently ignored, and in order to keep same behavior, we remove the parameter. [1] https://bugs.python.org/issue41877 [2] python/cpython#23737 Change-Id: I092d48b9806c4cd6f8b2ecbedd7ab5b7c6d20c04
patch, patch.object and create_autospec silently ignore misspelled
arguments such as autospect, auto_spec and set_spec. This can lead
to tests failing to check what they are supposed to check.
This change adds a check causing a RuntimeError if the above
functions get any of the above misspellings as arguments. It also
adds a new argument, "unsafe", which can be set to True to disable
this check.
https://bugs.python.org/issue41877