]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128377: Skip `test_cmd_line.test_non_interactive_output_buffering` when `PYTHONUNB...
authorYan Yanchii <yyanchiy@gmail.com>
Sun, 12 Jan 2025 08:27:28 +0000 (09:27 +0100)
committerGitHub <noreply@github.com>
Sun, 12 Jan 2025 08:27:28 +0000 (09:27 +0100)
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.

Lib/test/test_cmd_line.py

index dfdbb80b94d66f3b808612ff8c98e9097b64adba..24cf357c581096c002a4a8d808f73fb2568dbda6 100644 (file)
@@ -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