Skip to content

Commit db03cb9

Browse files
authored
[3.11] gh-107237: Fix test_udp_reconnection() of test_logging (#107238) (#107245)
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 ed08238)
1 parent 1bc1609 commit db03cb9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Lib/test/test_logging.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1981,25 +1981,25 @@ def test_output(self):
19811981
# The log message sent to the SysLogHandler is properly received.
19821982
logger = logging.getLogger("slh")
19831983
logger.error("sp\xe4m")
1984-
self.handled.wait()
1984+
self.handled.wait(support.LONG_TIMEOUT)
19851985
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
19861986
self.handled.clear()
19871987
self.sl_hdlr.append_nul = False
19881988
logger.error("sp\xe4m")
1989-
self.handled.wait()
1989+
self.handled.wait(support.LONG_TIMEOUT)
19901990
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m')
19911991
self.handled.clear()
19921992
self.sl_hdlr.ident = "h\xe4m-"
19931993
logger.error("sp\xe4m")
1994-
self.handled.wait()
1994+
self.handled.wait(support.LONG_TIMEOUT)
19951995
self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
19961996

19971997
def test_udp_reconnection(self):
19981998
logger = logging.getLogger("slh")
19991999
self.sl_hdlr.close()
20002000
self.handled.clear()
20012001
logger.error("sp\xe4m")
2002-
self.handled.wait(0.1)
2002+
self.handled.wait(support.LONG_TIMEOUT)
20032003
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
20042004

20052005
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
``test_logging``: Fix ``test_udp_reconnection()`` by increasing the timeout
2+
from 100 ms to 5 minutes (LONG_TIMEOUT). Patch by Victor Stinner.

0 commit comments

Comments
 (0)