[Twisted-Python] Get trial to use the docstring?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Aug 5 15:49:56 EDT 2010

On 07:08 pm, glyph at twistedmatrix.com wrote:
>On Aug 5, 2010, at 2:33 PM, Nathan wrote:
>>Is there already a way to get twisted to print out a test's docstring
>>(like unittest does) instead of the name of the function in it's
>>output?  I've looked at trial's options and searched the list
>>archives, but I'm not seeing anything...
>>For example, here's what my tests look like when run by unittest:
>>$ test/run.py -v
>>==> Starting Prerequisite Tests ... ok
>>Supported OS? ... ok
>>Supported version of Python? ... ok
>>And here's what they look like when run by trial:
>>$ trial test/run.py
>>  Test00Prerequisites
>>    test_00banner ... 
>>    test_01os ... 
>If you want to add a feature that prints out the docstring (or some 
>portion of it) _in addition_ to the test name, that would probably be 
>accepted as a patch.  But, in my mind, one of the most important 
>features of trial is the fact that it prints out stable identifiers for 
>the tests so you can see how to run them again when you're looking at 
>their results.  We should never omit that.  (In fact, I'd really like 
>it if trial always printed out a _full_ test identifier for easy 
>copy/pasting instead of sometimes only printing the method name.)

Also, trial reporters are pluggable, so you can always write and use a 
reporter that prints out exactly what you want printed out.


More information about the Twisted-Python mailing list