Repository navigation
Give the Windows IO backend the error messages its siblings have - #3509
dylanpulver wants to merge 5 commits into
Conversation
wait_readable / wait_writable raised a bare BusyResourceError, and notify_closing a bare ClosedResourceError. The epoll and kqueue backends describe both. _io_windows already passes a message for the lpOverlapped case, so it was inconsistent with itself too. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3509 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19454 19551 +97
Branches 1321 1330 +9
===============================================
+ Hits 19454 19551 +97
🚀 New features to boost your workflow:
|
|
BTW for future contributions I think you should avoid LLM generated PR descriptions. If you have nothing to say, that's fine. (though I appreciate the acknowledgement that Claude helped write this) |
A5rocks
left a comment
There was a problem hiding this comment.
Both these errors have coverage I assume, but no tests changed? Are the tests just not checking the message? Could you update the tests too?
These tests only checked the exception type, which is why the empty Windows BusyResourceError and ClosedResourceError went unnoticed. The messages differ per backend, so the assertion is that there is one. Stripping the messages from the kqueue backend fails 12 of these tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
| with pytest.raises(_core.BusyResourceError): | ||
| with pytest.raises(_core.BusyResourceError) as busy: | ||
| await wait_readable(a) | ||
| assert str(busy.value), "the error should say why the resource is busy" |
There was a problem hiding this comment.
use pytest's match argument instead
Same assertion, the idiom the reviewer asked for. Stripping the messages from the kqueue backend still fails 12 of these tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
|
Both points are in, pushed on 23 Sept. I should have said so at the time rather than leaving this sitting. @A5rocks the tests now check the message, not just the type. @CoolCat467 that check is Stripping the three messages out of I also cut the description down. |
|
Still kind of wish message matching was there but fine I guess |
Taking the review point. `match=r"\S"` only asserted a message existed, so rewording one would not have been noticed. `ClosedResourceError` is the same sentence on all three backends up to the last word, so the test matches "another task closed this " directly. `BusyResourceError` has two unrelated texts: epoll and windows say "another task is already reading / writing this ...", kqueue says "attempt to register multiple listeners for same ident/filter pair". BUSY_MESSAGE matches either, so the assertion is that the message is one of the two real ones. Rewording kqueue's two messages while keeping them non-empty now fails 12 of the 29 tests in test_io.py. The same rewording passed all 29 under `r"\S"`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo
|
Message matching is in.
BUSY_MESSAGE = r"already reading / writing this|multiple listeners for same ident"which asserts the message is one of the two real ones rather than just non-empty. The difference it makes, rewording kqueue's two messages while keeping them non-empty: That is the gap you were pointing at. 29 pass unchanged, and |
On Windows,
wait_readable/wait_writableraiseBusyResourceErrorwith no message andnotify_closingraisesClosedResourceErrorwith no message. The epoll and kqueue backends pass text for both, and_io_windows.pypasses text for thelpOverlappedcase in the same file.I used "socket" rather than epoll's "fd", since
_afd_pollandnotify_closingresolve their argument through_get_base_socket. Happy to make them character-identical to the epoll strings instead.The tests assert the message through
pytest.raises(..., match=r"\S")rather than through the text, because the wording differs per backend. Stripping the three messages from_io_kqueue.pyfails 12 of the 29 tests intest_io.py.I'm on macOS, so the Windows suite is unrun here.
🤖 Generated with Claude Code
https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo