]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (#147973)
authorVictor Stinner <vstinner@python.org>
Thu, 2 Apr 2026 11:45:59 +0000 (13:45 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Apr 2026 11:45:59 +0000 (13:45 +0200)
Lib/test/test_pyrepl/test_pyrepl.py

index 082215da0a3fbaee7a272efbffcfcdeefbc9facf..8854b19efce0192d726ce1dd4f3fcebe2da2aadf 100644 (file)
@@ -44,6 +44,10 @@ try:
     import pty
 except ImportError:
     pty = None
+try:
+    import readline as readline_module
+except ImportError:
+    readline_module = None
 
 
 class ReplTestCase(TestCase):
@@ -1947,9 +1951,12 @@ class TestMain(ReplTestCase):
         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)