[TIP] how can I find in TestCase whether runs verbosely?
robertc at robertcollins.net
Sun Feb 17 16:37:14 PST 2013
On 18 February 2013 13:09, Chris Jerdonek <chris.jerdonek at gmail.com> wrote:
> On Sun, Feb 17, 2013 at 3:29 PM, Robert Collins
> <robertc at robertcollins.net> wrote:
>> On 18 February 2013 08:47, Matěj Cepl <mcepl at redhat.com> wrote:
>>> I would like to make my unittest testsuite to drop some intermediate
>>> test results when it is run with -v in the verbose mode. How can I find
>>> out in the TestCase object, that the run is verbose?
>> Can I ask why?
>> The idea is that there are two completely separate(*) things happening :
>> Tests are running
>> Something is showing the result of those tests to users.
>> Then, the tests should give all data to the result all the time, and
>> the result can choose whether to show a particular thing or not (and
>> how to do so - write to XML, print to screen, submit to a web
> I agree with Robert's point, but for the record there are at least a
> couple parts of the existing TestCase API that control how much data
> is given, for example the longMessage and maxDiff attributes of
> So it is possible that there are valid use cases.
Interesting! The maxdiff case looks like a useful thing to reduce
bandwidth and processing for things that won't be shown, but strictly
redundant with a result that just trimmed the output. longMessage I'm
less clear on - I don't understand why you'd ever not show both the
exception and the message. If we delivered both things separately the
result could take that decision though.
More generally, I do think there is room for TestCase to take
decisions, but I think we need to be very careful that we don't end up
re-doing the same support code in each TestCase implementation
(py.test, nose, unittest2, testtools, trial, zope.testrunner, ....)
for things that the UI can sensibly tackle.
Robert Collins <rbtcollins at hp.com>
HP Cloud Services
More information about the testing-in-python