[issue30839] Larger and/or configurable _MAX_LENGTH for unittest messages

Maarten ter Huurne report at bugs.python.org
Mon Jul 3 13:59:26 EDT 2017


New submission from Maarten ter Huurne:

In a unit test for one of my projects I am comparing tree-structured objects using assertEqual(). Because there can be a few nested levels, the repr() string can exceed the _MAX_LENGTH which is just 80 characters. Not by much, but enough to get shortened and therefore requiring extra effort to figure out where the difference is.

I think it is useful to shorten the messages at some point, to avoid accidentally spamming the log with pages of output that no-one is going to read. However, 80 characters is a length that someone debugging a failing test case can easily deal with. So I think the limit could be set an order of magnitude larger.

Making the maximum length configurable would also solve the issue, but still it would be good to increase the default maximum then, in my opinion.

The discussion of #27432 mentions _MAX_LENGTH customization, but that issue is not primarily about _MAX_LENGTH.

----------
components: Library (Lib)
messages: 297605
nosy: maarten-treewalker
priority: normal
severity: normal
status: open
title: Larger and/or configurable _MAX_LENGTH for unittest messages
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30839>
_______________________________________


More information about the Python-bugs-list mailing list