cheroot.test.test_makefile module#
Tests for cheroot.makefile.
- class cheroot.test.test_makefile.MockSocket#
Bases:
objectA mock socket.
- _decref_socketios()#
Emulate socket I/O reference decrement.
- recv(size)#
Simulate
recvfor Python 2.
- recv_into(buf)#
Simulate
recv_intofor Python 3.
- send(val)#
Simulate a send.
- class cheroot.test.test_makefile._RawWriteBlockAlways#
Bases:
objectMock raw.write() that always returns None.
- fileno()#
Return a fake fd for select().
- class cheroot.test.test_makefile._RawWriteBlockOnce#
Bases:
objectMock raw.write() returning None once, then writing normally.
- fileno()#
Return a fake fd for select().
- cheroot.test.test_makefile.test_bytes_read()#
Reader should capture bytes read.
- cheroot.test.test_makefile.test_bytes_written()#
Writer should capture bytes written.
- cheroot.test.test_makefile.test_flush_raises_on_sustained_block(monkeypatch)#
_flush_unlocked() raises BlockingIOError after select timeout.
If the socket stays blocked past SOCK_WRITE_TIMEOUT, the write buffer must be preserved and BlockingIOError raised.
- cheroot.test.test_makefile.test_flush_recovers_from_temporary_block(monkeypatch)#
_flush_unlocked() retries after select when raw.write() returns None.
A temporarily blocked socket should recover once select() reports the socket is writable again, delivering all buffered data.