Skip to content

Make BrokenPipeError test deterministic.#4127

Open
tjni wants to merge 3 commits into
Textualize:masterfrom
tjni:deterministic-brokenpipe-test
Open

Make BrokenPipeError test deterministic.#4127
tjni wants to merge 3 commits into
Textualize:masterfrom
tjni:deterministic-brokenpipe-test

Conversation

@tjni
Copy link
Copy Markdown

@tjni tjni commented May 17, 2026

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

AI?

  • AI was used to generate this PR

I used Codex with GPT-5.4 on Medium effort to investigate and generate local scripts to reproduce the flakiness as well as to create the initial version of the patch, but then I also manually read over and tweaked it to remove unnecessary lines such as certain comments and extra assertions.

Checklist

  • I've run the latest black with default args on new code.
  • I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate (see note about typos above).
  • I've added tests for new code.
  • I accept that @willmcgugan may be pedantic in the code review.

Description

test_brokenpipeerror seems to be flaky (albeit rarely). We can try to make it deterministic by writing more data during the test to reliably trigger BrokenPipeError.

I specifically ran into this while building python3Packages.rich from nixpkgs locally using Nix, and during research found that some other package managers have also disabled this test, e.g.:

I had Codex generate locally some scripts to reproduce this, and it was able to do so against Python 3.13 after a few hundred iterations, and with these changes I was not able to reproduce it again locally, so I feel it could be worth a try.

I have at present skipped creating a discussion because I feel this falls under "clear bug-fixes / typos etc". I also refrained from updating the CHANGELOG, because it appeared to me that entries under there look like external facing changes. I'm happy to make any changes needed, however.

Teddy Ni and others added 3 commits May 17, 2026 16:01
This test seems to be flaky (albeit rarely). We can try to make it
deterministic by writing more data during the test to reliably trigger
BrokenPipeError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant