From b9c71efeabdc7f1e5e820c0a8f70824567f1b2d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 25 Sep 2024 19:28:38 +0200 Subject: [PATCH] Add unset TERM= to the "dumb" terminal ignore as well --- Lib/_pyrepl/simple_interact.py | 2 +- Lib/test/test_pyrepl/test_pyrepl.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/_pyrepl/simple_interact.py b/Lib/_pyrepl/simple_interact.py index 6d1b9fbd5f5a38..342a4b58bfd0f3 100644 --- a/Lib/_pyrepl/simple_interact.py +++ b/Lib/_pyrepl/simple_interact.py @@ -28,6 +28,7 @@ import _sitebuiltins import linecache import functools +import os import sys import code @@ -50,7 +51,6 @@ def check() -> str: try: _get_reader() except _error as e: - import os # temporary debugging measure to understand the Address sanitizer environment failure if term := os.environ.get("TERM", ""): term = f"; TERM={term}" return str(str(e) or repr(e) or "unknown error") + term diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py index 1f272006a5736c..0f3e9996e77e45 100644 --- a/Lib/test/test_pyrepl/test_pyrepl.py +++ b/Lib/test/test_pyrepl/test_pyrepl.py @@ -1054,6 +1054,7 @@ def test_bracketed_paste_single_line(self): output = multiline_input(reader) self.assertEqual(output, input_code) + @skipUnless(pty, "requires pty") class TestDumbTerminal(ReplTestCase): def test_dumb_terminal_exits_cleanly(self): @@ -1065,8 +1066,9 @@ def test_dumb_terminal_exits_cleanly(self): self.assertNotIn("Exception", output) self.assertNotIn("Traceback", output) + @skipUnless(pty, "requires pty") -@skipIf(os.environ.get("TERM") == "dumb", "can't use pyrepl in dumb terminal") +@skipIf((os.environ.get("TERM") or "dumb") == "dumb", "can't use pyrepl in dumb terminal") class TestMain(ReplTestCase): def setUp(self): # Cleanup from PYTHON* variables to isolate from local