Skip to content

fix: correct error message for stdout pipe check in run_process#3416

Merged
jakkdl merged 8 commits intopython-trio:mainfrom
nightcityblade:fix/issue-3409
Apr 8, 2026
Merged

fix: correct error message for stdout pipe check in run_process#3416
jakkdl merged 8 commits intopython-trio:mainfrom
nightcityblade:fix/issue-3409

Conversation

@nightcityblade
Copy link
Copy Markdown
Contributor

Fixes #3409

The error message for the stdout=subprocess.PIPE check in run_process incorrectly said "stdin=subprocess.PIPE". This fixes it to say "stdout=subprocess.PIPE".

This is a recreation of #3398 with the same fix plus a newsfragment.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00000%. Comparing base (f418f64) to head (e8c3ba3).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@               Coverage Diff               @@
##                 main        #3416   +/-   ##
===============================================
  Coverage   100.00000%   100.00000%           
===============================================
  Files             128          128           
  Lines           19417        19418    +1     
  Branches         1318         1318           
===============================================
+ Hits            19417        19418    +1     
Files with missing lines Coverage Δ
src/trio/_subprocess.py 100.00000% <ø> (ø)
src/trio/_tests/test_subprocess.py 100.00000% <100.00000%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CoolCat467
Copy link
Copy Markdown
Member

You forgot to update the tests mate

@nightcityblade
Copy link
Copy Markdown
Contributor Author

Good catch @CoolCat467! Updated the test to match the corrected error message — the stdin pipe check now expects stdin=subprocess.PIPE instead of stdout=subprocess.PIPE. Thanks for the review!

@A5rocks
Copy link
Copy Markdown
Contributor

A5rocks commented Apr 5, 2026

Please fix the news fragment syntax!

pipe_stdin_error = r"^stdin=subprocess\.PIPE is only valid with nursery\.start, since that's the only way to access the pipe(; use nursery\.start or pass the data you want to write directly)*$"
with pytest.raises(ValueError, match=pipe_stdin_error):
await run_process(CAT, stdin=subprocess.PIPE)
pipe_stdout_error = r"^stdout=subprocess\.PIPE is only valid with nursery\.start, since that's the only way to access the pipe(; use nursery\.start or pass the data you want to write directly)*$"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last part uses a * but I think the regex can be more specific.

(Same comment applies for the one above, too)

@nightcityblade
Copy link
Copy Markdown
Contributor Author

Fixed — switched to double backticks (code) for proper RST syntax. Thanks @A5rocks!

@A5rocks
Copy link
Copy Markdown
Contributor

A5rocks commented Apr 6, 2026

Please address the review too! (and you don't need to write out a comment acknowledging what you finished; the commits have that data.)

Copy link
Copy Markdown
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was thinking something like this. What do you think?

Copy link
Copy Markdown
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'm not sure why pre-commit is erroring on this PR... The error message doesn't make sense, because your branch doesn't have either of the listed versions!

Hopefully just pulling in main works :/

@jakkdl jakkdl merged commit c5c4b7c into python-trio:main Apr 8, 2026
81 of 83 checks passed
@trio-bot
Copy link
Copy Markdown

trio-bot bot commented Apr 8, 2026

Hey @nightcityblade, it looks like that was the first time we merged one of your PRs! Thanks so much! 🎉 🎂

If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:

  • Github will automatically subscribe you to notifications on all our repositories. (But you can unsubscribe again if you don't want the spam.)

  • You'll be able to help us manage issues (add labels, close them, etc.)

  • You'll be able to review and merge other people's pull requests

  • You'll get a [member] badge next to your name when participating in the Trio repos, and you'll have the option of adding your name to our member's page and putting our icon on your Github profile (details)

If you want to read more, here's the relevant section in our contributing guide.

Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you.

If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out!

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.

Incorrect error message for trio.run_process's stdout check

5 participants