cheroot.test.test_makefile module#
Tests for cheroot.makefile.
- class cheroot.test.test_makefile.MockRawIO#
Bases:
objectA mock
io.RawIOBaseobject for use as the raw layer of aBufferedWriter.- close()#
Emulate close.
- property closed#
Emulate the required
closedproperty.
- writable()#
Indicate that the raw stream supports writing.
- write(message)#
Emulate
io.RawIOBase write.
- class cheroot.test.test_makefile.MockSocket#
Bases:
objectA mock socket for emulating buffered I/O.
- _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.
- 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_close_error_handling(exc, reraises, mocker)#
Test that expected socket errors are swallowed and others re-raised.
- cheroot.test.test_makefile.test_close_is_idempotent()#
Test that double
close()does not error out.
- cheroot.test.test_makefile.test_close_when_raw_already_closed()#
Test that
close()is safe when the raw buffer was closed externally.Simulates a race where the OS or another thread closed the raw socket before
BufferedWriter.close()is called.
- cheroot.test.test_makefile.test_flush_unlocked_handles_blocking_io_error(mocker)#
Test that
BlockingIOErroris handled by extractingcharacters_written.