Skip to content

Commit

Permalink
Fix the pytest error for async io (#559)
Browse files Browse the repository at this point in the history
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.

Authors:
  - Tianyu Liu (https://github.com/kingcrimsontianyu)

Approvers:
  - Vukasin Milovanovic (https://github.com/vuule)
  - Mads R. B. Kristensen (https://github.com/madsbk)

URL: #559
  • Loading branch information
kingcrimsontianyu authored Nov 21, 2024
1 parent 5ff93bc commit b0e7bd1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/kvikio/tests/test_async_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def test_read_write(tmp_path, size):
assert f.raw_write_async(a, stream.ptr).check_bytes_done() == a.nbytes

# Try to read file opened in write-only mode
with pytest.raises(RuntimeError, match="Operation not permitted"):
# POSIX read would yield the error "Operation not permitted"
# cuFile read would yield the error "unsupported file open flags"
with pytest.raises(
RuntimeError, match="Operation not permitted|unsupported file open flags"
):
# The exception is raised when we call the raw_read_async API.
future_stream = f.raw_read_async(a, stream.ptr)
future_stream.check_bytes_done()
Expand Down

0 comments on commit b0e7bd1

Please sign in to comment.