[Python-Dev] unittest: shortDescription, _TextTestResult and other issues

Michael Foord fuzzyman at voidspace.org.uk
Tue Feb 9 23:36:23 CET 2010


On 09/02/2010 22:22, Olemis Lang wrote:
> On Tue, Feb 9, 2010 at 4:50 PM, Ben Finney<ben+python at benfinney.id.au>  wrote:
>    
>> Michael Foord<michael at voidspace.org.uk>  writes:
>>
>>      
>>> It seems to me that the same effect (always reporting test name) can
>>> be achieved in _TextTestResult.getDescription(). I propose to revert
>>> the change to TestCase.shortDescription() (which has both a horrible
>>> name and a horrible implementation and should probably be renamed
>>> getDocstring so that what it does is obvious but never mind) and put
>>> the change into _TextTestResult.
>>>        
>>      
> [...]
>    
>> I've overridden that method to provide better, more specific, test case
>> short descriptions, and the name works fine since I'm providing an
>> overridden implementation of “the short description of this test case”.
>>      
>
> Oh yes ! Thnx for mentioning that ! Very much !
>
> If you move or remove shortDescription then I think dutest will be
> broken. In that case there is an automatically generated short
> description  comprising the doctest name or id (e.g. class name +
> method name ;o) and example index (just remember that every
> interactive example is considered to be a test case ;o)
>    

I am *not* suggesting removing shortDescription I am suggesting 
reverting to its behavior in Python 2.6. That would not affect your or 
Ben's use case (obviously). Given the name 'short description' it is 
being argued that making the description longer by adding the test name 
is inappropriate and that if this needs to be reported (which it should 
be) then this rightly belongs in the TestResult.

Michael Foord

> In that case there is no other way to get this done unless an
> all-mighty&  heavy test result be implemented .
>
> So I am *VERY* -1 for removing `shortDescription` (and I also think
> that TC should be the one to provide the short desc rather than the
> test result, just like what Ben Finney said before ;o)
>
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.




More information about the Python-Dev mailing list