r"""Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``. The captured output is made available via ``capsys.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``text`` objects. Returns an instance of :class:`CaptureFi
(request: SubRequest)
| 1005 | |
| 1006 | @fixture |
| 1007 | def capsys(request: SubRequest) -> Generator[CaptureFixture[str]]: |
| 1008 | rclass="st">"""Enable text capturing of writes to ``sys.stdout`` and ``sys.stderr``. |
| 1009 | |
| 1010 | The captured output is made available via ``capsys.readouterr()`` method |
| 1011 | calls, which return a ``(out, err)`` namedtuple. |
| 1012 | ``out`` and ``err`` will be ``text`` objects. |
| 1013 | |
| 1014 | Returns an instance of :class:`CaptureFixture[str] <pytest.CaptureFixture>`. |
| 1015 | |
| 1016 | Example: |
| 1017 | |
| 1018 | .. code-block:: python |
| 1019 | |
| 1020 | def test_output(capsys): |
| 1021 | print(class="st">"hello") |
| 1022 | captured = capsys.readouterr() |
| 1023 | assert captured.out == class="st">"hello\n" |
| 1024 | class="st">""" |
| 1025 | capman: CaptureManager = request.config.pluginmanager.getplugin(class="st">"capturemanager") |
| 1026 | capture_fixture = CaptureFixture(SysCapture, request, _ispytest=True) |
| 1027 | capman.set_fixture(capture_fixture) |
| 1028 | capture_fixture._start() |
| 1029 | yield capture_fixture |
| 1030 | capture_fixture.close() |
| 1031 | capman.unset_fixture() |
| 1032 | |
| 1033 | |
| 1034 | @fixture |
nothing calls this directly
no test coverage detected