2026-10-17
- #617: Fixed
assert_has_callsraisingValueErrorinstead ofAssertionError(or showing misleading introspection) when the expected calls are plain tuples rather thancall(...)objects, such as(args, kwargs)entries of another mock'scall_args_list,(args,),(kwargs,),(name, args)or(name, kwargs). - #621: Fixed
mocker.stop()sometimes stopping the wrong mock, for example with mocks frommocker.create_autospec. - #621:
mocker.stop()now undoes the most recent patch first when the same object is used in several patches. - #623: Fixed misleading introspection in
assert_has_awaitsfailures, andassert_has_calls/assert_has_awaitsraisingIndexErrorinstead ofAssertionErrorwhencallsis passed by keyword. - #624: Clear
spy_return_iterafter a spied synchronous or asynchronous function raises, matchingspy_return. - #627: Document
async_stubawait assertions and the distinction between call and await tracking. - #629: Fixed
mocker.resetall()skipping the mocks patched withmocker.patch.multiple(), both the ones it creates and the ones passed explicitly. - #630:
mocker.resetall()now also resetsspy_returnandspy_exceptionof spies, like it already did forspy_return_listandspy_return_iter, and no longer overwrites attributes with these names on mocks that are not spies. - #633: Fixed spies on
classmethod,staticmethod, builtins and classes returning aMagicMockinstead of calling the spied code aftermocker.resetall(side_effect=True). Resetting a spy'sside_effectnow goes back to calling the spied code, also clearing anyside_effectset on the spy.