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 Randy Syring
Recipients Randy Syring
Date 2015-07-30.19:07:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438283225.26.0.251368779344.issue24758@psf.upfronthosting.co.za>
In-reply-to
Content
In issue http://bugs.python.org/issue21238 a feature was introduced to help prevent false-positive test cases by throwing an AttributeError whenever a non-existent method prefixed with "assert_" is used on a mock object.

I had mock objects with legitimate "assert_*" methods that had been working for some time.  My tests included calls like:

my_mock.assert_in_status.assert_called_once_with(...)

My tests started failing unexpectedly and it took me HOURS to figure out that I had a new mock version installed.  Those hours could have been turned into seconds my simply giving a better error message, something like:

AttributeError: you used "assert_in_status" but that method is not a valid Mock assert method.  Please check your spelling.  If this was not a typing mistake, you can use the `unsafe` keyword argument to the Mock instance to turn this validation check off.  See https://mock-docs...org/ for more details.
History
Date User Action Args
2015-07-30 19:07:05Randy Syringsetrecipients: + Randy Syring
2015-07-30 19:07:05Randy Syringsetmessageid: <1438283225.26.0.251368779344.issue24758@psf.upfronthosting.co.za>
2015-07-30 19:07:05Randy Syringlinkissue24758 messages
2015-07-30 19:07:04Randy Syringcreate