-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the pytest error for async io #559
Fix the pytest error for async io #559
Conversation
python/kvikio/tests/test_async_io.py
Outdated
# Try to read file opened in write-only mode | ||
with pytest.raises(RuntimeError, match="Operation not permitted"): | ||
with pytest.raises(RuntimeError, match=expected_except_msg): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big fan of tests that check the error message content, but that's not on this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like we're adding a lot of APIs (some public?) just for this error. Can we instead just verify that the error matches one of these strings, without worrying about which one? That would let us remove all the is_compat_mode_preferred
logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I'm wondering if ideally the public function is_compat_mode_preferred()
and is_compat_mode_preferred_for_async()
should be included in the Python API, or are they considered too low-level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Python API addition has been reverted for now.
c661e9d
to
2ccd3f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @kingcrimsontianyu
/merge |
This PR fixes #558
The root cause is that POSIX and cuFile report different error messages for the same invalid operation which attempts to read from a write-only file. The unit test needs to take account of these different messages.