From 08dd6db752be87a3992b069d6a406e7107622289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Tue, 6 Jan 2026 11:10:18 +0100 Subject: [PATCH] gh-143394: On macOS, run main PyREPL tests as "Apple Terminal" as well (GH-143461) (cherry picked from commit 7dae1077cd18c1ddc50b130335936bc71e1c4ccd) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ɓukasz Langa --- Lib/test/test_pyrepl/test_pyrepl.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 9c365007bebcc9..add987ee3d19cb 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -2002,6 +2002,17 @@ def test_no_newline(self): self.assertIn(expected_output_sequence, cleaned_output) +@skipUnless(sys.platform == "darwin", "macOS only") +class TestMainAppleTerminal(TestMain): + """Test the REPL with Apple Terminal's TERM_PROGRAM set.""" + + def run_repl(self, repl_input, env=None, **kwargs): + if env is None: + env = os.environ.copy() + env["TERM_PROGRAM"] = "Apple_Terminal" + return super().run_repl(repl_input, env=env, **kwargs) + + class TestPyReplCtrlD(TestCase): """Test Ctrl+D behavior in _pyrepl to match old pre-3.13 REPL behavior.