diff options
author | Samuel Freilich <sfreilich@google.com> | 2019-09-24 19:08:31 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-24 19:08:31 (GMT) |
commit | b5a7a4f0c20717a4c92c371583b5521b83f40f32 (patch) | |
tree | f3f4df016736fca9503e1a8a6c28dc10222bbb43 /Misc | |
parent | bb6bf7d342b4503a6227fd209fac934905b6a1aa (diff) | |
download | cpython-b5a7a4f0c20717a4c92c371583b5521b83f40f32.zip cpython-b5a7a4f0c20717a4c92c371583b5521b83f40f32.tar.gz cpython-b5a7a4f0c20717a4c92c371583b5521b83f40f32.tar.bz2 |
bpo-36871: Handle spec errors in assert_has_calls (GH-16005)
The fix in PR 13261 handled the underlying issue about the spec for specific methods not being applied correctly, but it didn't fix the issue that was causing the misleading error message.
The code currently grabs a list of responses from _call_matcher (which may include exceptions). But it doesn't reach inside the list when checking if the result is an exception. This results in a misleading error message when one of the provided calls does not match the spec.
https://bugs.python.org/issue36871
Automerge-Triggered-By: @gpshead
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2019-09-24-18-45-46.bpo-36871.p47knk.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-09-24-18-45-46.bpo-36871.p47knk.rst b/Misc/NEWS.d/next/Core and Builtins/2019-09-24-18-45-46.bpo-36871.p47knk.rst new file mode 100644 index 0000000..6b7b19a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2019-09-24-18-45-46.bpo-36871.p47knk.rst @@ -0,0 +1,3 @@ +Improve error handling for the assert_has_calls and assert_has_awaits methods of +mocks. Fixed a bug where any errors encountered while binding the expected calls +to the mock's spec were silently swallowed, leading to misleading error output. |