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.

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

Reader should return None, not crash, if nothing is available yet.

A non-blocking socket’s read() can return None per the documented io.RawIOBase contract when no data is available; this used to blow up on len(None). Ref: cherrypy/cheroot#278