pytest icon indicating copy to clipboard operation
pytest copied to clipboard

separate reporting -r and output capture to allow -rA to NOT report output for passing tests

Open okken opened this issue 4 weeks ago • 0 comments

What's the problem this feature will solve?

The -r flag controls both summary report and output capture reporting.
Really, it'd be nice to have those separate.

For large tests suites, -ra is often used to report the reason for non-passing tests per test in the summary. For small test suites, -rA is common, as it lists all tests in the summary, including passing.

However, it also reports captured output.
I know there is --show-capture=no. But that turns off showing captured output for failures also.

Describe the solution you'd like

I'd like a way to separate -r functionality into:

  • which outcomes should show summary reports
  • which outcomes should show captured output

However, I know -r is legacy and the default behavior can't change.

But maybe some other way to turn off capture for everything. These are verbose, but maybe --capture-on that takes chars that matches the -r chars.

So -rA --capture-on=a would report on all, including passing, but capture on all except passing.

The default behavior could stay with "whatever -r" is set to.

Alternative Solutions

Different flag or option name is ok.

Additional context

We had a similar issue with tracebacks, and added --xfail-tb to deal with that.
But output capture is still an issue, and a surprising one, as the documentation for -rA doesn't mention that it turns on passing output capture.

okken avatar Nov 13 '25 19:11 okken