bpo-41877: Check for misspelled speccing arguments#23737
Merged
gpshead merged 7 commits intopython:masterfrom Dec 14, 2020
vabr-g:issue-41877-arguments-check
Merged
bpo-41877: Check for misspelled speccing arguments#23737gpshead merged 7 commits intopython:masterfrom vabr-g:issue-41877-arguments-check
gpshead merged 7 commits intopython:masterfrom
vabr-g:issue-41877-arguments-check
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.
gpshead
reviewed
Dec 10, 2020
Also revert changes forced by `unsafe` being positional, and add "!r" to format specifiers in added error messages.
Contributor
Author
|
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
Contributor
Author
|
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. |
gpshead
reviewed
Dec 11, 2020
Member
gpshead
left a comment
There was a problem hiding this comment.
all my remaining comments are minor
adorilson
pushed a commit
to adorilson/cpython
that referenced
this pull request
Mar 13, 2021
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.
openstack-mirroring
pushed a commit
to openstack/openstacksdk
that referenced
this pull request
Dec 1, 2021
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
openstack-mirroring
pushed a commit
to openstack/openstack
that referenced
this pull request
Dec 1, 2021
* 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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