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

Function test_capture_binary_output

testing/test_capture.py:808–826  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

806
807
808def test_capture_binary_output(pytester: Pytester) -> None:
809 pytester.makepyfile(
810 r"""
811 import pytest
812
813 def test_a():
814 import sys
815 import subprocess
816 subprocess.call([sys.executable, __file__])
817
818 def test_foo():
819 import os;os.write(1, b'\xc3')
820
821 if __name__ == '__main__':
822 test_foo()
823 """
824 )
825 result = pytester.runpytest("--assert=plain")
826 result.assert_outcomes(passed=2)
827
828
829def test_error_during_readouterr(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected