]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 4 Apr 2026 08:38:43 +0000 (10:38 +0200)
committerGitHub <noreply@github.com>
Sat, 4 Apr 2026 08:38:43 +0000 (08:38 +0000)
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 <vstinner@python.org>
Lib/test/test_pyrepl/test_pyrepl.py

index d8a06f0ee9df6fcbb38cfe81f7100043a96f1729..60561e5663f26c531c239ec41a1e4d1cacb1306f 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):
@@ -1937,9 +1941,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)