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