Skip to content

Commit 670b6cc

Browse files
authored
gh-132912: Use SHORT_TIMEOUT in test_remote_pdb (#132939)
Replace hardcoded timeout of 5 seconds with SHORT_TIMEOUT.
1 parent 6cbeb6a commit 670b6cc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Lib/test/test_remote_pdb.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import unittest.mock
1414
from contextlib import contextmanager
1515
from pathlib import Path
16-
from test.support import is_wasi, os_helper
16+
from test.support import is_wasi, os_helper, SHORT_TIMEOUT
1717
from test.support.os_helper import temp_dir, TESTFN, unlink
1818
from typing import Dict, List, Optional, Tuple, Union, Any
1919

@@ -415,7 +415,7 @@ def test_connect_and_basic_commands(self):
415415
self._send_command(client_file, "c")
416416

417417
# Wait for process to finish
418-
stdout, _ = process.communicate(timeout=5)
418+
stdout, _ = process.communicate(timeout=SHORT_TIMEOUT)
419419

420420
# Check if we got the expected output
421421
self.assertIn("Function returned: 42", stdout)
@@ -458,7 +458,7 @@ def test_breakpoints(self):
458458

459459
# Continue to end
460460
self._send_command(client_file, "c")
461-
stdout, _ = process.communicate(timeout=5)
461+
stdout, _ = process.communicate(timeout=SHORT_TIMEOUT)
462462

463463
self.assertIn("Function returned: 42", stdout)
464464
self.assertEqual(process.returncode, 0)
@@ -467,7 +467,7 @@ def test_keyboard_interrupt(self):
467467
"""Test that sending keyboard interrupt breaks into pdb."""
468468
synchronizer_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
469469
synchronizer_sock.bind(('127.0.0.1', 0)) # Let OS assign port
470-
synchronizer_sock.settimeout(5)
470+
synchronizer_sock.settimeout(SHORT_TIMEOUT)
471471
synchronizer_sock.listen(1)
472472
self.addCleanup(synchronizer_sock.close)
473473
sync_port = synchronizer_sock.getsockname()[1]
@@ -529,7 +529,7 @@ def bar():
529529
# Continue to end as fast as we can
530530
self._send_command(client_file, "iterations = 0")
531531
self._send_command(client_file, "c")
532-
stdout, _ = process.communicate(timeout=5)
532+
stdout, _ = process.communicate(timeout=SHORT_TIMEOUT)
533533
self.assertIn("Function returned: 42", stdout)
534534
self.assertEqual(process.returncode, 0)
535535

@@ -547,7 +547,7 @@ def test_handle_eof(self):
547547
client_file.flush()
548548

549549
# The process should complete normally after receiving EOF
550-
stdout, stderr = process.communicate(timeout=5)
550+
stdout, stderr = process.communicate(timeout=SHORT_TIMEOUT)
551551

552552
# Verify process completed correctly
553553
self.assertIn("Function returned: 42", stdout)
@@ -597,7 +597,7 @@ def run_test():
597597
self.assertIn('protocol version', message['message'])
598598

599599
# The process should complete normally
600-
stdout, stderr = process.communicate(timeout=5)
600+
stdout, stderr = process.communicate(timeout=SHORT_TIMEOUT)
601601

602602
# Verify the process completed successfully
603603
self.assertIn("Test result: True", stdout)
@@ -639,7 +639,7 @@ def test_help_system(self):
639639
# Continue execution to finish the program
640640
self._send_command(client_file, "c")
641641

642-
stdout, stderr = process.communicate(timeout=5)
642+
stdout, stderr = process.communicate(timeout=SHORT_TIMEOUT)
643643
self.assertIn("Function returned: 42", stdout)
644644
self.assertEqual(process.returncode, 0)
645645

@@ -697,7 +697,7 @@ def test_multi_line_commands(self):
697697
# Continue execution to finish
698698
self._send_command(client_file, "c")
699699

700-
stdout, stderr = process.communicate(timeout=5)
700+
stdout, stderr = process.communicate(timeout=SHORT_TIMEOUT)
701701
self.assertIn("Function returned: 42", stdout)
702702
self.assertEqual(process.returncode, 0)
703703

0 commit comments

Comments
 (0)