pytest-dev / pytest-dev/pytest

`tee-fd`/`capteefd` - file descriptor level capture with pass-through

Open
#14,159 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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?

It does not seem to be possible to capture all output including subprocesses in JUnit report while being able to judge the progress of test execution by the output passed through to the terminal.

--capture=fd does the former, but not the latter. --capture=no does the latter, but not the former. --capture=tee-sys does the pass-through, but fails to capture subprocess output, which will only be available in the terminal without the structure of JUnit report.

Describe the solution you'd like

It would be nice to have tee-fd capture mode and, perhaps, an accompanying capteefd fixture. They would capture at file descriptor level like fd/capfd, but would also pass-through test output like tee-fd/capteefd.

This would be best of both worlds - all output of tests including subprocesses would be captured and stored in JUnit report while pass-through output would allow to monitor progress.

Alternative Solutions

Not sure this can be worked around using a plugin since capturing is a core feature.

Additional context

We are using pytest to run high level end-to-end tests of non-Python code. This involves launching subprocesses and the output of subprocesses is crucial for failure analysis. Tests are long-running and if there is no output it is difficult to judge whether everything progresses as usual or the test simply hanged. Tests produce a lot of output, so we use JUnit reports to add some structure.

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 comparing the existing --capture=fd and --capture=tee-sys modes and the capfd/capteefd fixture behavior. Done means subprocess output is captured with the structure needed for JUnit reports while test output is also passed through to the terminal.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.