Skip to content

Truncate locals with large/long runtime values in failure message #75

@thejunglejane

Description

@thejunglejane

Is your feature request related to a problem? Please describe.
Currently, marbles doesn't do anything with local variables before putting them in the failure message beyond casting them to strings. When local variables have really long string representations, they can overwhelm the failure message, which is unpleasant to look at but also hinders the failure message's readability.

Describe the solution you'd like
I would like marbles to truncate long local variables, probably using the same length settings as unittest.util.

unittest.util has some repr-truncating functionality that we could use, and/or we could also use reprlib.

Describe alternatives you've considered
A workaround for this is to have the test author make locals with long runtime values internal so they don't show up in the failure message at all. If they want the test consumer to be able to see those local variables, the test author can create their own public local that is the truncated representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions