]> granicus.if.org Git - python/commit
[3.8] bpo-36871: Handle spec errors in assert_has_calls (GH-16005) (GH-16364)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 25 Sep 2019 00:29:17 +0000 (17:29 -0700)
committerGitHub <noreply@github.com>
Wed, 25 Sep 2019 00:29:17 +0000 (17:29 -0700)
commit1a17a054f6314ce29cd2632c28aeed317a615360
treeb4485b4c10a71f53c94db096e28d9e36eb6732bd
parent081641fe520382d48ffead158ab528180f72017d
[3.8] bpo-36871: Handle spec errors in assert_has_calls (GH-16005) (GH-16364)

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
(cherry picked from commit b5a7a4f0c20717a4c92c371583b5521b83f40f32)

Co-authored-by: Samuel Freilich <sfreilich@google.com>
https://bugs.python.org/issue36871

Automerge-Triggered-By: @gpshead
Lib/unittest/mock.py
Lib/unittest/test/testmock/testasync.py
Lib/unittest/test/testmock/testmock.py
Misc/NEWS.d/next/Core and Builtins/2019-09-24-18-45-46.bpo-36871.p47knk.rst [new file with mode: 0644]