Truncate locals with large/long runtime values in failure message
- Dominant language
- Python
- Stars
- 155
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
**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`](https://github.com/python/cpython/blob/master/Lib/unittest/util.py).
`unittest.util` has some repr-truncating functionality that we could use, and/or we could also use [`reprlib`](https://docs.python.org/3/library/reprlib.html).
**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.
Contributor guide
Assessment
This issue has not been assessed yet.