Skip to content

Commit 2a00d94

Browse files
[3.13] gh-143394: Skip pyrepl test_no_newline() basic REPL if readline is missing (GH-147973) (#148006)
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 1e60efd commit 2a00d94

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
@@ -33,6 +33,10 @@
3333
import pty
3434
except ImportError:
3535
pty = None
36+
try:
37+
import readline as readline_module
38+
except ImportError:
39+
readline_module = None
3640

3741

3842
class ReplTestCase(TestCase):
@@ -1418,9 +1422,12 @@ def test_no_newline(self):
14181422
commands = "print('Something pretty long', end='')\nexit()\n"
14191423
expected_output_sequence = "Something pretty long>>> exit()"
14201424

1421-
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1422-
self.assertEqual(basic_exit_code, 0)
1423-
self.assertIn(expected_output_sequence, basic_output)
1425+
# gh-143394: The basic REPL needs the readline module to turn off
1426+
# ECHO terminal attribute.
1427+
if readline_module is not None:
1428+
basic_output, basic_exit_code = self.run_repl(commands, env=env)
1429+
self.assertEqual(basic_exit_code, 0)
1430+
self.assertIn(expected_output_sequence, basic_output)
14241431

14251432
output, exit_code = self.run_repl(commands)
14261433
self.assertEqual(exit_code, 0)

0 commit comments

Comments
 (0)