https://github.com/python/cpython/commit/bd5121b1c054c594e0686be08258ab56576c7aae commit: bd5121b1c054c594e0686be08258ab56576c7aae branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: pablogsal <[email protected]> date: 2024-07-20T14:32:41Z summary:
[3.13] gh-121988: Fix test hang when pyrepl is not available (GH-121990) (#122064) gh-121988: Fix test hang when pyrepl is not available (GH-121990) Also explicitly fail the test if we timeout while waiting for output so that this failure mode is caught earlier. (cherry picked from commit a09e215abf3c80a3c99c86b4482b512b42aad072) Co-authored-by: Sam Gross <[email protected]> files: M Lib/test/test_pyrepl/test_pyrepl.py diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index e6fcb69571c324..e3feeeb76f11d6 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -964,7 +964,7 @@ def _run_repl_globals_test(self, expectations, *, as_file=False, as_module=False mod.write_text("FOO = 42", encoding="utf-8") commands = [ "print(f'{" + var + "=}')" for var in expectations - ] + ["exit"] + ] + ["exit()"] if as_file and as_module: self.fail("as_file and as_module are mutually exclusive") elif as_file: @@ -1115,6 +1115,10 @@ def run_repl( except OSError: break output.append(data) + else: + os.close(master_fd) + process.kill() + self.fail(f"Timeout while waiting for output, got: {''.join(output)}") os.close(master_fd) try: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
