From 39c632f1e53ad7ce3aa941839978f2e361890b76 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 6 Jul 2024 07:14:48 +0300 Subject: [PATCH 1/2] gh-121351: skip test_not_wiping_history_file() if no readline --- Lib/test/test_pyrepl/test_pyrepl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 7621b8af808f53..8bbc2962b004df 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -20,6 +20,7 @@ more_lines, multiline_input, code_to_events, + import_module ) from _pyrepl.console import Event from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig @@ -902,6 +903,9 @@ def test_python_basic_repl(self): self.assertNotIn("Traceback", output) def test_not_wiping_history_file(self): + # skip, if readline module is not available + import_module('readline') + hfile = tempfile.NamedTemporaryFile(delete=False) self.addCleanup(unlink, hfile.name) env = os.environ.copy() From f41875afbc9885215acb49f6d305a607a584f8b4 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sat, 6 Jul 2024 14:28:20 +0300 Subject: [PATCH 2/2] + fix import --- Lib/test/test_pyrepl/test_pyrepl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 8bbc2962b004df..015b690566223d 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -11,6 +11,7 @@ from unittest.mock import patch from test.support import force_not_colorized from test.support import SHORT_TIMEOUT +from test.support.import_helper import import_module from test.support.os_helper import unlink from .support import ( @@ -20,7 +21,6 @@ more_lines, multiline_input, code_to_events, - import_module ) from _pyrepl.console import Event from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig