Skip to content

Commit 4e6db26

Browse files
vstinnermiss-islington
authored andcommitted
gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973)
(cherry picked from commit 97babb8) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent ea9ecc8 commit 4e6db26

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
import pty
4545
except ImportError:
4646
pty = None
47+
try:
48+
import readline as readline_module
49+
except ImportError:
50+
readline_module = None
4751

4852

4953
class ReplTestCase(TestCase):
@@ -1937,9 +1941,12 @@ def test_no_newline(self):
19371941
commands = "print('Something pretty long', end='')\nexit()\n"
19381942
expected_output_sequence = "Something pretty long>>> exit()"
19391943

1940-
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1941-
self.assertEqual(basic_exit_code, 0)
1942-
self.assertIn(expected_output_sequence, basic_output)
1944+
# gh-143394: The basic REPL needs the readline module to turn off
1945+
# ECHO terminal attribute.
1946+
if readline_module is not None:
1947+
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1948+
self.assertEqual(basic_exit_code, 0)
1949+
self.assertIn(expected_output_sequence, basic_output)
19431950

19441951
output, exit_code = self.run_repl(commands)
19451952
self.assertEqual(exit_code, 0)

0 commit comments

Comments
 (0)