[Python-Dev] unittest: shortDescription, _TextTestResult and other issues (original) (raw)
Michael Foord fuzzyman at voidspace.org.uk
Wed Feb 10 12:11:53 CET 2010
- Previous message: [Python-Dev] unittest: shortDescription, _TextTestResult and other issues
- Next message: [Python-Dev] unittest: shortDescription, _TextTestResult and other issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/02/2010 01:07, Ben Finney wrote:
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”. The code for giving information about individual test results is the TestResult. The TestRunner knows nothing about each individual result (or even about each individual test as it happens). The TestRunner is responsible for the whole test run, the TestCase runs individual tests and the TestResult reports (or holds) individual test results (at the behest of the TestCase).
Given this structure it is not possible for test descriptions to be the responsibility of the TestRunner and I don't feel like re-structuring unittest today. :-)
Michael
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.
-- 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.
- Previous message: [Python-Dev] unittest: shortDescription, _TextTestResult and other issues
- Next message: [Python-Dev] unittest: shortDescription, _TextTestResult and other issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]