[TIP] Annotated tracebacks

Chris Jerdonek chris.jerdonek at gmail.com
Sun Oct 19 23:30:00 PDT 2014


On Sun, Oct 19, 2014 at 5:00 PM, Robert Collins
<robertc at robertcollins.net> wrote:
> On 20 October 2014 12:41, Chris Jerdonek <chris.jerdonek at gmail.com> wrote:
>> On Sun, Oct 19, 2014 at 4:29 PM, Robert Collins
>
>> arbitrary limit.  How do you propose handling that?  If the API
>> doesn't allow showing more characters, it can be frustrating because
>> the initial limit was arbitrary to begin with.
>
> For the API side of it, clearly a parameter or configuration
> supplied/set somehow.
>
> For unittest and other clients of the API, it will be a per-client
> thing to decide how to accept input from the user and pass it through.
>
> For unittest specifically, we also have this problem in some assertion
> output today; if (I don't recall) its configurable now, the same
> option should suffice. If its not, we can add one and address both via
> it.

The issue I had in mind with unittest was the code printing truncated
repr()'s (e.g. when assertNotEqual fails).  When I looked into it, it
didn't seem like the truncation length was configurable as part of the
public API.  I believe the code is here:

https://hg.python.org/cpython/file/e906e23931fa/Lib/unittest/util.py#l8

See the _common_shorten_repr() function and the associated internal
constants _MAX_LENGTH, etc.

--Chris

>
> -Rob
>
> --
> Robert Collins <rbtcollins at hp.com>
> Distinguished Technologist
> HP Converged Cloud



More information about the testing-in-python mailing list