Open yarikoptic opened 2 years ago
Perhaps it makes sense for us to detect we are running on CI and not truncate at all? I recall we already do something similar to truncate tracebacks...
not sure if worth "on CI" -- the same effect is observed when stdout is not a terminal, i.e. if gets piped to | cat
.
Fair enough.
Can you provide a reproducible example? I'd like to take a stab at this :)
#!/bin/bash
set -x
cd "$(mktemp -d ${TMPDIR:-/tmp}/pytest-XXXXXXX)"
cat >| test_some_path_could_be_long.py <<EOF
def test_short_fail():
assert False
def test_veryyyyyyyyy_long_test_name_just_because_no_long_path():
assert False # which could be long line too
EOF
python3 -m pytest test_some_path_could_be_long.py
python3 -m pytest test_some_path_could_be_long.py | cat
would end with
FAILED test_some_path_could_be_long.py::test_short_fail - assert False
FAILED test_some_path_could_be_long.py::test_veryyyyyyyyy_long_test_name_just_because_no_long_path
so no the assert False
like in previous output without | cat
ping on this
Could we have a flag that just stops the truncation of the summary? I would personally just use that in general, even outside of CI.
What's the problem this feature will solve?
Currently we cannot easily grasp the summary of underlying fails/errors which happened on CIs (logs archived using https://github.com/con/tinuous/) because "short test summary info" truncates to the width of the terminal which is in non-interactive session happens to be around 80. So we get just e.g.
The only workaround I found is to specify explicitly COLUMNS env var to be of some higher value on CI, but that would make the entire log wider, so wider section headers etc.
Ideally I wish there was some pytest setting which would take and not truncate the first line (i.e. split by
\n
) of that line to be displayed so in the captured logs we have it in its entirety.