[New-bugs-announce] [issue21238] unittest.mock.Mock should not allow you to use non-existent assert methods

Michael Foord report at bugs.python.org
Tue Apr 15 17:51:18 CEST 2014


New submission from Michael Foord:

A common problem with unittest.mock.Mock is to mistype an assert method. Because mocks create attributes on demand your test will pass without error.

We should raise an AttributeError if you access any attribute name (that doesn't exist) starting with assert or assret. There should also be a keyword argument allowing you to get the old behaviour if you need it (but this new feature should be on by default).

Will also need docs.

----------
assignee: michael.foord
components: Library (Lib)
messages: 216320
nosy: kushal.das, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: unittest.mock.Mock should not allow you to use non-existent assert methods
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21238>
_______________________________________


More information about the New-bugs-announce mailing list