MCPcopy
hub / github.com/tornadoweb/tornado / test_inline_read_error

Method test_inline_read_error

tornado/test/iostream_test.py:831–861  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

829 @skipIfNonUnix
830 @gen_test
831 def test_inline_read_error(self):
832 # An error on an inline read is raised without logging (on the
833 # assumption that it will eventually be noticed or logged further
834 # up the stack).
835 #
836 # This test is posix-only because windows os.close() doesn't work
837 # on socket FDs, but we can't close the socket object normally
838 # because we won't get the error we want if the socket knows
839 # it's closed.
840 #
841 # This test is also disabled when the
842 # AddThreadSelectorEventLoop is used, because a race between
843 # this thread closing the socket and the selector thread
844 # calling the select system call can make this test flaky.
845 # This event loop implementation is normally only used on
846 # windows, making this check redundant with skipIfNonUnix, but
847 # we sometimes enable it on other platforms for testing.
848 io_loop = IOLoop.current()
849 if isinstance(
850 io_loop.selector_loop, # type: ignore[attr-defined]
851 AddThreadSelectorEventLoop,
852 ):
853 self.skipTest("AddThreadSelectorEventLoop not supported")
854 server, client = yield self.make_iostream_pair()
855 try:
856 os.close(server.socket.fileno())
857 with self.assertRaises(socket.error):
858 server.read_bytes(1)
859 finally:
860 server.close()
861 client.close()
862
863 @gen_test
864 def test_async_read_error_logging(self):

Callers

nothing calls this directly

Calls 5

make_iostream_pairMethod · 0.95
currentMethod · 0.80
read_bytesMethod · 0.80
closeMethod · 0.45
filenoMethod · 0.45

Tested by

no test coverage detected