Skip to content

Commit 97babb8

Browse files
authored
gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (#147973)
1 parent 7817651 commit 97babb8

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):
@@ -1947,9 +1951,12 @@ def test_no_newline(self):
19471951
commands = "print('Something pretty long', end='')\nexit()\n"
19481952
expected_output_sequence = "Something pretty long>>> exit()"
19491953

1950-
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1951-
self.assertEqual(basic_exit_code, 0)
1952-
self.assertIn(expected_output_sequence, basic_output)
1954+
# gh-143394: The basic REPL needs the readline module to turn off
1955+
# ECHO terminal attribute.
1956+
if readline_module is not None:
1957+
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1958+
self.assertEqual(basic_exit_code, 0)
1959+
self.assertIn(expected_output_sequence, basic_output)
19531960

19541961
output, exit_code = self.run_repl(commands)
19551962
self.assertEqual(exit_code, 0)

0 commit comments

Comments
 (0)