`test_cmd_line.test_non_interactive_output_buffering` fails when `PYTHONUNBUFFERED` is enabled · Issue #128377 · python/cpython · GitHub
Skip to content

test_cmd_line.test_non_interactive_output_buffering fails when PYTHONUNBUFFERED is enabled #128377

Description

@WolframAlph

Bug report

Bug description:

Reproducer:

➜  cpython git:(main) ✗ export PYTHONUNBUFFERED=1         
➜  cpython git:(main) ✗ python3 -m test test_cmd_line
Using random seed: 2481773783
Raised RLIMIT_NOFILE: 256 -> 1024
0:00:00 load avg: 2.40 Run 1 test sequentially in a single process
0:00:00 load avg: 2.40 [1/1] test_cmd_line
test test_cmd_line failed -- Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/test/test_cmd_line.py", line 348, in test_non_interactive_output_buffering
    self.assertEqual(proc.stdout,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                     'False False False\n'
                     ^^^^^^^^^^^^^^^^^^^^^
                     'False False True\n')
                     ^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'False True False\nFalse True False\n' != 'False False False\nFalse False True\n'
- False True False
?       ^^^
+ False False False
?       ^^^^
- False True False
+ False False True


test_cmd_line failed (1 failure)

== Tests result: FAILURE ==

1 test failed:
    test_cmd_line

Total duration: 2.8 sec
Total tests: run=59 failures=1 skipped=1
Total test files: run=1/1 failed=1
Result: FAILURE

Test expects buffered stdio but does not check for PYTHONUNBUFFERED.
Init config for buffering:

cpython/Python/initconfig.c

Lines 1786 to 1790 in e389d6c

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions