mirror of https://github.com/python/cpython.git
gh-107237: Fix test_udp_reconnection() of test_logging (#107238)
test_logging: Fix test_udp_reconnection() by increasing the timeout
from 100 ms to 5 minutes (LONG_TIMEOUT).
Replace also blocking wait() with wait(LONG_TIMEOUT) in
test_output() to prevent the test to hang.
(cherry picked from commit ed08238327
)
This commit is contained in:
parent
1bc160947e
commit
db03cb953a
|
@ -1981,17 +1981,17 @@ def test_output(self):
|
|||
# The log message sent to the SysLogHandler is properly received.
|
||||
logger = logging.getLogger("slh")
|
||||
logger.error("sp\xe4m")
|
||||
self.handled.wait()
|
||||
self.handled.wait(support.LONG_TIMEOUT)
|
||||
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
|
||||
self.handled.clear()
|
||||
self.sl_hdlr.append_nul = False
|
||||
logger.error("sp\xe4m")
|
||||
self.handled.wait()
|
||||
self.handled.wait(support.LONG_TIMEOUT)
|
||||
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m')
|
||||
self.handled.clear()
|
||||
self.sl_hdlr.ident = "h\xe4m-"
|
||||
logger.error("sp\xe4m")
|
||||
self.handled.wait()
|
||||
self.handled.wait(support.LONG_TIMEOUT)
|
||||
self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
|
||||
|
||||
def test_udp_reconnection(self):
|
||||
|
@ -1999,7 +1999,7 @@ def test_udp_reconnection(self):
|
|||
self.sl_hdlr.close()
|
||||
self.handled.clear()
|
||||
logger.error("sp\xe4m")
|
||||
self.handled.wait(0.1)
|
||||
self.handled.wait(support.LONG_TIMEOUT)
|
||||
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
|
||||
|
||||
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
``test_logging``: Fix ``test_udp_reconnection()`` by increasing the timeout
|
||||
from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner.
|
Loading…
Reference in New Issue