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

Ben Finney ben+python at benfinney.id.au
Wed Feb 10 02:07:11 CET 2010


Michael Foord <fuzzyman at voidspace.org.uk> writes:

> On 09/02/2010 21:50, Ben Finney wrote:
> > I understood the point of ‘TestCase.shortDescription’, and indeed
> > the point of that particular name, was to be clear that some *other*
> > text could be the short description for the test case. Indeed, this
> > is what you've come up with: a different implementation for
> > generating a short description.
>
> Given that the change broke something, and the desired effect can be
> gained with a different change, I don't really see a downside to the
> change I'm proposing (reverting shortDescription and moving the code
> that adds the test name to TestResult).

What you describe (adding the class and method name when reporting
the test) sounds like it belongs in the TestRunner, since it's more a
case of “give me more information about the test result”.

That is, a TestRunner that reports each result *with* the extra
information would be useful, for some cases, but should not modify the
TestResult instance to do that.

Am I right that this approach would avoid breakage in the case of
frameworks that don't expect their TestRunner to behave that way? e.g.
Twisted could simply use the TestRunner that doesn't behave this way,
and (since the TestResult instances aren't any different) continue to
get the expected behaviour.

-- 
 \     “If nothing changes, everything will remain the same.” —Barne's |
  `\                                                               Law |
_o__)                                                                  |
Ben Finney



More information about the Python-Dev mailing list