From: Yan Yanchii Date: Sun, 12 Jan 2025 08:27:28 +0000 (+0100) Subject: gh-128377: Skip `test_cmd_line.test_non_interactive_output_buffering` when `PYTHONUNB... X-Git-Tag: v3.14.0a4~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6;p=thirdparty%2FPython%2Fcpython.git gh-128377: Skip `test_cmd_line.test_non_interactive_output_buffering` when `PYTHONUNBUFFERED=1` (#128378) The `test_cmd_line.test_non_interactive_output_buffering` test assumes a buffered `stdio` without checking the `PYTHONUNBUFFERED` value. Instead of changing the environment variable for the duration of the test, it is better to simply skip it. --- diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index dfdbb80b94d6..24cf357c5810 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -336,6 +336,8 @@ class CmdLineTest(unittest.TestCase): self.assertEqual(stdout, expected) self.assertEqual(p.returncode, 0) + @unittest.skipIf(os.environ.get("PYTHONUNBUFFERED", "0") != "0", + "Python stdio buffering is disabled.") def test_non_interactive_output_buffering(self): code = textwrap.dedent(""" import sys