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

Method test_noserver

Lib/test/test_logging.py:1924–1941  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1922 self.assertEqual(self.log_output, "spam\neggs\n")
1923
1924 def test_noserver(self):
1925 if self.server_exception:
1926 self.skipTest(self.server_exception)
1927 # Avoid timing-related failures due to SocketHandler's own hard-wired
1928 # one-second timeout on socket.create_connection() (issue #16264).
1929 self.sock_hdlr.retryStart = 2.5
1930 # Kill the server
1931 self.server.stop()
1932 # The logging call should try to connect, which should fail
1933 try:
1934 raise RuntimeError('Deliberate mistake')
1935 except RuntimeError:
1936 self.root_logger.exception('Never sent')
1937 self.root_logger.error('Never sent, either')
1938 now = time.time()
1939 self.assertGreater(self.sock_hdlr.retryTime, now)
1940 time.sleep(self.sock_hdlr.retryTime - now + 0.001)
1941 self.root_logger.error('Nor this')
1942
1943
1944@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")

Callers

nothing calls this directly

Calls 7

skipTestMethod · 0.80
assertGreaterMethod · 0.80
stopMethod · 0.45
exceptionMethod · 0.45
errorMethod · 0.45
timeMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected