cheroot.test.test_makefile module#

Tests for cheroot.makefile.

class cheroot.test.test_makefile.MockSocket#

Bases: object

A mock socket.

_decref_socketios()#

Emulate socket I/O reference decrement.

recv(size)#

Simulate recv for Python 2.

recv_into(buf)#

Simulate recv_into for Python 3.

send(val)#

Simulate a send.

class cheroot.test.test_makefile._RawWriteBlockOnce#

Bases: object

Mock raw.write() that returns None on the first call, then writes normally.

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_when_raw_write_returns_none()#

_flush_unlocked() must not treat None from raw.write() as a byte count.

io.RawIOBase.write() returns None when a non-blocking socket cannot accept data. del self._write_buf[:None] is equivalent to del self._write_buf[:] which silently clears the entire buffer, truncating the response without raising an exception.