MCPcopy Create free account
hub / github.com/PabloLec/RecoverPy / test_read_block_io_error

Function test_read_block_io_error

tests/unit/test_block_extractor.py:41–53  ·  view source on GitHub ↗
(mocker)

Source from the content-addressed store, hash-verified

39
40
41def test_read_block_io_error(mocker):
42 mocker.patch("os.open", return_value=42)
43 mocker.patch(
44 "os.pread",
45 side_effect=OSError(errno.EIO, "I/O error"),
46 )
47 close_mock = mocker.patch("os.close")
48
49 with pytest.raises(BlockExtractionError) as error:
50 read_block("/dev/sda1", 4096, 0)
51
52 assert "I/O error" in error.value.user_message
53 close_mock.assert_called_once_with(42)

Callers

nothing calls this directly

Calls 1

read_blockFunction · 0.90

Tested by

no test coverage detected