From 25956ee170f451c7289afef3256e7f5e09b5eb8b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 1 Apr 2026 16:59:00 +0200 Subject: [PATCH] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing --- 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 082215da0a3fba..8854b19efce019 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -44,6 +44,10 @@ import pty except ImportError: pty = None +try: + import readline as readline_module +except ImportError: + readline_module = None class ReplTestCase(TestCase): @@ -1947,9 +1951,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)