8000 gh-107237: Fix test_udp_reconnection() of test_logging (#107238) · python/cpython@ed08238 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed08238

Browse files
authored
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.
1 parent 6261585 commit ed08238

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Lib/test/test_logging.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,25 +2079,25 @@ def test_output(self):
20792079
# The log message sent to the SysLogHandler is properly received.
20802080
logger = logging.getLogger("slh")
20812081
logger.error("sp\xe4m")
2082-
self.handled.wait()
2082+
self.handled.wait(support.LONG_TIMEOUT)
20832083
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
20842084
self.handled.clear()
20852085
self.sl_hdlr.append_nul = False
20862086
logger.error("sp\xe4m")
2087-
self.handled.wait()
2087+
self.handled.wait(support.LONG_TIMEOUT)
20882088
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m')
20892089
self.handled.clear()
20902090
self.sl_hdlr.ident = "h\xe4m-"
20912091
logger.error("sp\xe4m")
2092-
self.handled.wait()
2092+
self.handled.wait(support.LONG_TIMEOUT)
20932093
self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
20942094

20952095
def test_udp_reconnection(self):
20962096
logger = logging.getLogger("slh")
20972097
self.sl_hdlr.close()
20982098
self.handled.clear()
20992099
logger.error("sp\xe4m")
2100-
self.handled.wait(0.1)
2100+
self.handled.wait(support.LONG_TIMEOUT)
21012101
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m\x00')
21022102

21032103
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
Lines changed: 2 additions & 0 deletions
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)
0