pytest-dev / pytest-dev/pytest

Provide dedicated control over truncation of "short test summary info" lines

Open
#10,264 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

topic: reporting type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

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.

(git)smaug:/mnt/datasets/datalad/ci/logs/2022/08[master]git
$> git grep  '^FAIL.*test_gracefull_dea'                               
03/pr/6915/964b1f4/travis-14378-failed/2.txt:FAILED ../datalad/support/tests/test_parallel.py::test_gracefull_death - asse...
03/pr/6915/964b1f4/travis-14378-failed/4.txt:FAILED ../support/tests/test_parallel.py::test_gracefull_death - assert 0 >= 2
23/pr/6958/fa7cee0/travis-14469-failed/9.txt:FAILED ../datalad/support/tests/test_parallel.py::test_gracefull_death - asse...
29/pr/6981/2551844/travis-14510-failed/3.txt:FAILED ../support/tests/test_parallel.py::test_gracefull_death - assert [0, 2...
30/push/maint/870c72a/travis-14519-failed/9.txt:FAILED ../datalad/support/tests/test_parallel.py::test_gracefull_death - asse...

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating pytest's handling of "short test summary info" and terminal-width truncation; the issue does not name specific files or tests. Check how the COLUMNS environment variable affects output, then define a pytest setting that preserves the first line without widening unrelated output and add coverage for the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.