[Python-Dev] Using more specific methods in Python unit tests

Ned Deily nad at acm.org
Sun Feb 16 00:20:28 CET 2014

In article 
<1392492250.26338.83831085.39A5ED08 at webmail.messagingengine.com>,
 Benjamin Peterson <benjamin at python.org> wrote:
> On Sat, Feb 15, 2014, at 10:12 AM, Serhiy Storchaka wrote:
> > Although Raymond approved a patch for test_bigmem [2], his expressed the 
> > insistent recommendation not to do this. So I stop committing new 
> > reviewed patches. Terry recommended to discuss this in Python-Dev. What 
> > are your thoughts? 
> I tend to agree with Raymond. I think such changes are very welcome when
> the module or tests are otherwise being changed, but on their on
> constitute unnecessary churn.


Integrity of the test suite and minimizing code churn top any benefits 
of more specific messages on failures.  The expectation is that most 
tests will never fail so their changed messages will never be seen.  For 
the rare cases when a test does fail, quite often the test was written 
in a way that will require examination of the code to understand exactly 
what the test case was intending to test and why it failed.  Having a 
more specific exception message wouldn't help for many tests without 
further modifications; the key point is to know that the test failed.

 Ned Deily,
 nad at acm.org

More information about the Python-Dev mailing list