summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYan Yanchii <yyanchiy@gmail.com>2025-01-12 08:27:28 (GMT)
committerGitHub <noreply@github.com>2025-01-12 08:27:28 (GMT)
commit30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6 (patch)
treecdc78190b6d6eb5afa282f9200e6d352102b685e
parent22a442181d5f1ac496dac08e24fd852de404882f (diff)
downloadcpython-30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6.zip
cpython-30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6.tar.gz
cpython-30268b5d2fbb1a5e6c876f0cdc4cbdb5d93315e6.tar.bz2
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.
-rw-r--r--Lib/test/test_cmd_line.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index dfdbb80..24cf357 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