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

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Aug 5 15:08:03 EDT 2010

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
> run
>  Test00Prerequisites
>    test_00banner ...                                                      [OK]
>    test_01os ...                                                          [OK]
> ...


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.)

More information about the Twisted-Python mailing list