From d9d42021ddbb5037f127a844e80e17921554818c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 2 Apr 2026 13:45:59 +0200 Subject: [PATCH] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973) (cherry picked from commit 97babb8ef70c1c25768a0e534cfb10955c6b290d) Co-authored-by: Victor Stinner --- Lib/test/test_pyrepl/test_pyrepl.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index c4d58f15d2f898..bbb69fe160fb03 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -33,6 +33,10 @@ import pty except ImportError: pty = None +try: + import readline as readline_module +except ImportError: + readline_module = None class ReplTestCase(TestCase): @@ -1418,9 +1422,12 @@ def test_no_newline(self): commands = "print('Something pretty long', end='')\nexit()\n" expected_output_sequence = "Something pretty long>>> exit()" - basic_output, basic_exit_code = self.run_repl(commands, env=env) - self.assertEqual(basic_exit_code, 0) - self.assertIn(expected_output_sequence, basic_output) + # gh-143394: The basic REPL needs the readline module to turn off + # ECHO terminal attribute. + if readline_module is not None: + basic_output, basic_exit_code = self.run_repl(commands, env=env) + self.assertEqual(basic_exit_code, 0) + self.assertIn(expected_output_sequence, basic_output) output, exit_code = self.run_repl(commands) self.assertEqual(exit_code, 0)