]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41877: Check for misspelled speccing arguments (GH-23737)
authorvabr-g <vabr@google.com>
Mon, 14 Dec 2020 18:30:09 +0000 (19:30 +0100)
committerGitHub <noreply@github.com>
Mon, 14 Dec 2020 18:30:09 +0000 (10:30 -0800)
commitfdb9efce6ac211f973088eef508740c3fa2bd182
tree9a109d25ccc8f22ed03710e3390fffc0b586674b
parent42c9f0fd0a5e67d4ae0022bfd7370cb9725a5b01
bpo-41877: Check for misspelled speccing arguments (GH-23737)

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.
Lib/unittest/mock.py
Lib/unittest/test/testmock/testmock.py
Misc/NEWS.d/next/Library/2020-12-10-19-49-52.bpo-41877.wiVlPc.rst [new file with mode: 0644]