Skip to content

TST: Harden handling of Popen subprocesses - #31503

Merged
tacaswell merged 4 commits into
matplotlib:mainfrom
QuLogic:popen-contexts
Apr 16, 2026
Merged

tacaswell merged 4 commits into
matplotlib:mainfrom
QuLogic:popen-contexts

Conversation

@QuLogic

@QuLogic QuLogic commented Apr 16, 2026 •

Copy link
Copy Markdown
Member

PR summary

This PR does two things:

  • Wrap _WaitForStringPopen in a context manager: We do attempt to kill the subprocess in all cases, but this should also ensure that file descriptors are closed.
  • Avoid the hard-coded port in test_webagg

I don't know that this would fix CI, but I'm hoping that at least the context manager will prevent the unraisable warning that leaks into other tests.

AI Disclosure

None

PR checklist

QuLogic added 3 commits April 15, 2026 22:46
We do attempt to kill the subprocess in all cases, but this should also
ensure that file descriptors are closed.
If the port's in use, then we want to allow retries and connect to
whichever port it ends up on.
Just to be on the safe side that it closes.
Co-authored-by: Kyle Sunden <git@ksunden.space>
@tacaswell
tacaswell merged commit 328ee38 into matplotlib:main Apr 16, 2026
41 checks passed
@tacaswell tacaswell added this to the v3.11.0 milestone Apr 16, 2026
@QuLogic
QuLogic deleted the popen-contexts branch April 16, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants