MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_noserver

Method test_noserver

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

Source from the content-addressed store, hash-verified

1908 self.assertEqual(self.log_output, "spam\neggs\n")
1909
1910 def test_noserver(self):
1911 if self.server_exception:
1912 self.skipTest(self.server_exception)
1913 # Avoid timing-related failures due to SocketHandler's own hard-wired
1914 # one-second timeout on socket.create_connection() (issue #16264).
1915 self.sock_hdlr.retryStart = 2.5
1916 # Kill the server
1917 self.server.stop()
1918 # The logging call should try to connect, which should fail
1919 try:
1920 raise RuntimeError('Deliberate mistake')
1921 except RuntimeError:
1922 self.root_logger.exception('Never sent')
1923 self.root_logger.error('Never sent, either')
1924 now = time.time()
1925 self.assertGreater(self.sock_hdlr.retryTime, now)
1926 time.sleep(self.sock_hdlr.retryTime - now + 0.001)
1927 self.root_logger.error('Nor this')
1928
1929
1930@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