MCPcopy Index your code
hub / github.com/python/cpython / test_tcp_timeout

Method test_tcp_timeout

Lib/test/test_logging.py:2116–2125  ·  view source on GitHub ↗
(self, mock_socket)

Source from the content-addressed store, hash-verified

2114
2115 @patch('socket.socket')
2116 def test_tcp_timeout(self, mock_socket):
2117 instance_mock_sock = mock_socket.return_value
2118 instance_mock_sock.connect.side_effect = socket.timeout
2119
2120 with self.assertRaises(socket.timeout):
2121 logging.handlers.SysLogHandler(address=('localhost', 514),
2122 socktype=socket.SOCK_STREAM,
2123 timeout=1)
2124
2125 instance_mock_sock.close.assert_called()
2126
2127@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
2128class UnixSysLogHandlerTest(SysLogHandlerTest):

Callers

nothing calls this directly

Calls 2

assert_calledMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected