def test_reader_read_error(self): s = BytesIO(b"foobar\nfoobar") s = tcp.Reader(s) o = mock.MagicMock() o.read = mock.MagicMock(side_effect=socket.error) s.o = o tutils.raises(TcpDisconnect, s.read, 10)
def test_writer_flush_error(self): s = BytesIO() s = tcp.Writer(s) o = mock.MagicMock() o.flush = mock.MagicMock(side_effect=socket.error) s.o = o tutils.raises(TcpDisconnect, s.flush)
def test_reader_read_error(self): s = BytesIO(b"foobar\nfoobar") s = tcp.Reader(s) o = mock.MagicMock() o.read = mock.MagicMock(side_effect=socket.error) s.o = o with pytest.raises(exceptions.TcpDisconnect): s.read(10)
def test_writer_flush_error(self): s = BytesIO() s = tcp.Writer(s) o = mock.MagicMock() o.flush = mock.MagicMock(side_effect=socket.error) s.o = o with pytest.raises(exceptions.TcpDisconnect): s.flush()