MCPcopy
hub / github.com/pytest-dev/pytest / test_dontreadfrominput

Function test_dontreadfrominput

testing/test_capture.py:941–974  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

939
940
941def test_dontreadfrominput() -> None:
942 from _pytest.capture import DontReadFromInput
943
944 f = DontReadFromInput()
945 assert f.buffer is f # type: ignore[comparison-overlap]
946 assert not f.isatty() # type: ignore[unreachable]
947 with pytest.raises(OSError):
948 f.read()
949 with pytest.raises(OSError):
950 f.readlines()
951 iter_f = iter(f)
952 with pytest.raises(OSError):
953 next(iter_f)
954 with pytest.raises(UnsupportedOperation):
955 f.fileno()
956 with pytest.raises(UnsupportedOperation):
957 f.flush()
958 assert not f.readable()
959 with pytest.raises(UnsupportedOperation):
960 f.seek(0)
961 assert not f.seekable()
962 with pytest.raises(UnsupportedOperation):
963 f.tell()
964 with pytest.raises(UnsupportedOperation):
965 f.truncate(0)
966 with pytest.raises(UnsupportedOperation):
967 f.write(b"")
968 with pytest.raises(UnsupportedOperation):
969 f.writelines([])
970 assert not f.writable()
971 assert isinstance(f.encoding, str)
972 f.close() # just for completeness
973 with f:
974 pass
975
976
977def test_captureresult() -> None:

Callers

nothing calls this directly

Calls 15

isattyMethod · 0.95
readMethod · 0.95
readlinesMethod · 0.95
filenoMethod · 0.95
flushMethod · 0.95
readableMethod · 0.95
seekMethod · 0.95
seekableMethod · 0.95
tellMethod · 0.95
truncateMethod · 0.95
writeMethod · 0.95
writelinesMethod · 0.95

Tested by

no test coverage detected