MCPcopy Create free account
hub / github.com/pytest-dev/pytest / capfdbinary

Function capfdbinary

src/_pytest/capture.py:929–942  ·  view source on GitHub ↗

Enable bytes capturing of writes to file descriptors ``1`` and ``2``. The captured output is made available via ``capfd.readouterr()`` method calls, which return a ``(out, err)`` namedtuple. ``out`` and ``err`` will be ``byte`` objects.

(request: SubRequest)

Source from the content-addressed store, hash-verified

927
928@fixture
929def capfdbinary(request: SubRequest) -> Generator[CaptureFixture[bytes], None, None]:
930 """Enable bytes capturing of writes to file descriptors ``1`` and ``2``.
931
932 The captured output is made available via ``capfd.readouterr()`` method
933 calls, which return a ``(out, err)`` namedtuple.
934 ``out`` and ``err`` will be ``byte`` objects.
935 """
936 capman = request.config.pluginmanager.getplugin("capturemanager")
937 capture_fixture = CaptureFixture[bytes](FDCaptureBinary, request, _ispytest=True)
938 capman.set_fixture(capture_fixture)
939 capture_fixture._start()
940 yield capture_fixture
941 capture_fixture.close()
942 capman.unset_fixture()

Callers

nothing calls this directly

Calls 5

getpluginMethod · 0.80
set_fixtureMethod · 0.80
_startMethod · 0.80
unset_fixtureMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected