Message342030
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. |
|
Date |
User |
Action |
Args |
2019-05-10 01:24:07 | gregory.p.smith | set | recipients:
+ gregory.p.smith |
2019-05-10 01:24:07 | gregory.p.smith | set | messageid: <1557451447.6.0.296391075727.issue36871@roundup.psfhosted.org> |
2019-05-10 01:24:07 | gregory.p.smith | link | issue36871 messages |
2019-05-10 01:24:07 | gregory.p.smith | create | |
|