Skip to content

tests(hipfile): Add unit tests for hipFile python module - #8725

Merged
riley-dixon merged 2 commits into
developfrom
users/rildixon/hipfile-python-add-tests-new
Jul 17, 2026
Merged

tests(hipfile): Add unit tests for hipFile python module#8725
riley-dixon merged 2 commits into
developfrom
users/rildixon/hipfile-python-add-tests-new

Conversation

@riley-dixon

@riley-dixon riley-dixon commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

Adds unit tests to cover our high-level Python API

Technical Details

These tests are only to test the logic implemented by the high-level Python APIs added here. The Cython layer and C library are not tested here. To keep these tests hermetic, the Cython layer is faked.

Issue Tracking

JIRA ID: AIHIPFILE-164

Test Plan

New unit tests added

Test Result

See hipFile CI

Submission Checklist

@riley-dixon riley-dixon self-assigned this Jul 16, 2026
Copilot AI review requested due to automatic review settings July 16, 2026 21:34
@riley-dixon
riley-dixon requested a review from a team as a code owner July 16, 2026 21:34
@riley-dixon riley-dixon changed the title Users/rildixon/hipfile python add tests new hipFile: Add unit tests for hipFile python module Jul 16, 2026
@github-actions github-actions Bot added the github actions Pull requests that update GitHub Actions code label Jul 16, 2026
@therock-pr-bot

therock-pr-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

❌ PR Check — Action Required

Check Status Details
🌿 Branch Name ✅ Pass
📝 PR Title/Description ❌ Fail Error: Title does not follow Conventional Commits style.
Expected: start with a valid type (feat, fix, docs, …).
Desired format: type(optional-scope): short description
Forbidden Files ✅ Pass
🧪 Unit Test ✅ Pass
🔎 pre-commit ⏳ Pending ⏳ Still running…
🚫 Draft PR 🔜 To Be Enabled
🚩 Feature Flag 🔜 To Be Enabled
📊 Code Coverage 🔜 To Be Enabled

⚠️ 1 policy check(s) failed. Please address the issues above before this PR can be Reviewed.

🚫 Please fix the failed policies

  • ❌ PR Title/Description

The Not ready to Review label was added to this PR. Once all policies pass, the label is removed automatically.

📖 Need help? See the Policy FAQ for details on every check and how to fix failures.

@therock-pr-bot

Copy link
Copy Markdown

🚫 Please fix the failed policies before requesting reviews.

The following policy checks failed:

  • ❌ PR Title/Description

The Not ready to Review label has been added to this PR.
Once all policies pass, the label will be removed automatically.

@riley-dixon riley-dixon changed the title hipFile: Add unit tests for hipFile python module tests(Add unit tests for hipFile python module) Jul 16, 2026

Copilot AI left a comment

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.

Pull request overview

Adds a hermetic pytest unit-test suite for the high-level hipfile Python API (mocking the Cython extension via sys.modules) and wires these tests into the existing hipfile-python-bindings GitHub Actions workflow.

Changes:

  • Introduces hermetic unit tests covering Driver, FileHandle, Buffer, properties, enums, and HipFileException.
  • Adds shared pytest fixtures (conftest.py), local pytest discovery config (pytest.ini), and test-suite documentation (README.md).
  • Updates CI workflow to install pytest and execute the new unit tests inside the container.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/hipfile/python/tests/conftest.py Injects a fake hipfile._hipfile module and provides shared fixtures for hermetic unit tests.
projects/hipfile/python/tests/test_buffer.py Unit tests for hipfile.buffer.Buffer registration, error paths, and context manager behavior.
projects/hipfile/python/tests/test_driver.py Unit tests for hipfile.driver.Driver open/close, error handling, and context manager ordering.
projects/hipfile/python/tests/test_enums.py Unit tests for enum int-like behavior (currently focused on OpError).
projects/hipfile/python/tests/test_error.py Unit tests for HipFileException stored codes and string formatting.
projects/hipfile/python/tests/test_file.py Unit tests for FileHandle handle_type guards, open/close lifecycle, and read/write error contracts.
projects/hipfile/python/tests/test_properties.py Unit tests for get_version and driver_get_properties success/error behavior.
projects/hipfile/python/tests/README.md Documents test hermeticity approach, running instructions, and file coverage map.
projects/hipfile/python/tests/pytest.ini Local pytest configuration for discovery under python/tests.
.github/workflows/hipfile-python-bindings.yml Installs pytest and runs the new Python unit tests in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread projects/hipfile/python/tests/test_enums.py
Comment thread projects/hipfile/python/tests/test_error.py
These unit tests specifically target the higher-level Python API,
and do not test anything lower. These tests can be run without building
the Cython bindings.
@riley-dixon
riley-dixon force-pushed the users/rildixon/hipfile-python-add-tests-new branch from e7ee553 to 4e61158 Compare July 16, 2026 21:52
@riley-dixon riley-dixon changed the title tests(Add unit tests for hipFile python module) tests(hipfile): Add unit tests for hipFile python module Jul 16, 2026
@riley-dixon
riley-dixon merged commit 0e4167d into develop Jul 17, 2026
102 of 105 checks passed
@riley-dixon
riley-dixon deleted the users/rildixon/hipfile-python-add-tests-new branch July 17, 2026 17:22
systems-assistant Bot pushed a commit to ROCm/hipFile that referenced this pull request Jul 17, 2026
 (#8725)

## Motivation

Adds unit tests to cover our high-level Python API

## Technical Details

These tests are only to test the logic implemented by the high-level
Python APIs added here. The Cython layer and C library are not tested
here. To keep these tests hermetic, the Cython layer is faked.

## Issue Tracking

JIRA ID: AIHIPFILE-164

## Test Plan

New unit tests added

## Test Result

See hipFile CI

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
[rocm-systems] ROCm/rocm-systems#8725 (commit 0e4167d)
derobins pushed a commit that referenced this pull request Jul 22, 2026
## Motivation

The hipFile Python test suite has been broken at collection since the
async I/O
bindings (#7386): that PR added `AsyncIOHandle` and the async/stream
callables to
the extension and imported them in `file.py`, but never updated the fake
in
`conftest.py`. Every test importing `hipfile` errored during collection.
Missed
because CI wasn't re-run after the unit tests (#8725) landed.

## Technical Details

Add the missing async names to the fake extension in `conftest.py`: a
`_FakeAsyncIOHandle` stand-in plus success-shaped `hipFileReadAsync` /
`hipFileWriteAsync` / `hipFileStreamRegister` /
`hipFileStreamDeregister` /
`supports_async`. Tests-only change.

## Issue Tracking

JIRA ID: AIHIPFILE-171

## Test Plan

- Run the hipFile Python binding suite: `pytest
projects/hipfile/python/tests/`.
- Lint the changed file: `black --check` and `pylint` on `conftest.py`.

## Test Result

- `42 passed` (previously: 5 collection errors, suite could not run).
- `black --check`: file left unchanged. `pylint`: rated 10.00/10.

## Submission Checklist

- [x] Look over the contributing guidelines at
https://github.com/ROCm/rocm-systems/blob/develop/CONTRIBUTING.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github actions Pull requests that update GitHub Actions code organization: ROCm project: hipfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants