This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients gregory.p.smith
Date 2019-05-10.01:24:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557451447.6.0.296391075727.issue36871@roundup.psfhosted.org>
In-reply-to
Content
If you use a debugger on this, you'll discover that what is happening inside of mock's assert_has_calls is that it is catching and swallowing an exception around the inspect.Signature instances bind() call complaining about 'b' being an unexpected keyword argument.  Diving within the signature object being _used_ at the time, you find it checking against the signature of the class *constructor* rather than the methods. (!)

the real error here is that the mock.create_autospec(Thing) has created a mock of the class.  but the mock class (mock_thing) was never constructed.  Adding a call to the constructor makes this code work:

 mock_thing = mock.create_autospec(Thing)(constructor_param="spam")

But debugging this is insane, the error message is entirely misleading and shows two equal lists yet claiming they are different.
History
Date User Action Args
2019-05-10 01:24:07gregory.p.smithsetrecipients: + gregory.p.smith
2019-05-10 01:24:07gregory.p.smithsetmessageid: <1557451447.6.0.296391075727.issue36871@roundup.psfhosted.org>
2019-05-10 01:24:07gregory.p.smithlinkissue36871 messages
2019-05-10 01:24:07gregory.p.smithcreate