gh-128377: Skip `test_cmd_line.test_non_interactive_output_buffering` when `PYTHONUNBUFFERED=1` (#128378)
https://github.com/python/cpython/commit/30268b5d2fbb1a5e6c876f0cdc4cbdb5d93... commit: 30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6 branch: main author: Yan Yanchii <yyanchiy@gmail.com> committer: picnixz <10796600+picnixz@users.noreply.github.com> date: 2025-01-12T09:27:28+01:00 summary: 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. files: M Lib/test/test_cmd_line.py diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index dfdbb80b94d66f..24cf357c581096 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -336,6 +336,8 @@ def test_osx_android_utf8(self): 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
participants (1)
-
picnixz