Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capteesys capture fixture to bubble up output to --capture handler #12854

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
13 changes: 11 additions & 2 deletions doc/en/how-to/capture-stdout-stderr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
How to capture stdout/stderr output
=========================================================

Pytest can intercept stdout and stderr. Using the `--capture=` command-line
argument (described below) allows pytest to add captured output to reports
generated after tests. The reports can customized by `-r` (described below).

Built-in fixtures (also described below) can be passed to tests as arguments
to capture stdout and stderr and make it accessible to the developer during
the test for inspection. It will not be available for reports if it is captured,
unless it is re-printed with capturing turned off (see below).

ayjayt marked this conversation as resolved.
Show resolved Hide resolved
Default stdout/stderr/stdin capturing behaviour
---------------------------------------------------------

Expand Down Expand Up @@ -106,8 +115,8 @@ of the failing function and hide the other one:
Accessing captured output from a test function
---------------------------------------------------

The :fixture:`capsys`, :fixture:`capsysbinary`, :fixture:`capfd`, and :fixture:`capfdbinary` fixtures
allow access to ``stdout``/``stderr`` output created during test execution.
The :fixture:`capsys`, :fixture:`capteesys`, :fixture:`capsysbinary`, :fixture:`capfd`, and :fixture:`capfdbinary`
fixtures allow access to ``stdout``/``stderr`` output created during test execution.

Here is an example test function that performs some output related checks:

Expand Down