[ROCM-26203] Modify existing tests to work with pytest#4980
Open
eddieliao wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Python tests under test/py/ to behave correctly under pytest’s test discovery rules by preventing helper functions from being collected as tests.
Changes:
- Rename helper functions from
test_*to_test_*to avoid pytest collection. - Replace the old
test_conv_relu(format)pattern (which pytest interprets as needing a fixture) with two explicit tests for msgpack/json serialization. - Update copyright headers to 2026 in the modified files.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
test/py/test_save_load.py |
Renames the format-taking helper and adds explicit serialization tests (msgpack, json) to avoid pytest fixture/collection issues. |
test/py/test_array.py |
Renames test_shape helper to _test_shape and updates its call sites to prevent unintended pytest collection. |
Comments suppressed due to low confidence (1)
test/py/test_save_load.py:31
- The helper parameter name
formatshadows Python’s built-informat()and makes the call sites harder to read. Consider renaming the parameter to something more specific (e.g.,serialization_format) and forwarding that intomigraphx.save/load.
def _test_conv_relu(format):
p1 = migraphx.parse_onnx("conv_relu_maxpool_test.onnx")
print(p1)
s1 = p1.get_output_shapes()[-1]
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4980 +/- ##
========================================
Coverage 92.73% 92.73%
========================================
Files 592 594 +2
Lines 31289 31340 +51
========================================
+ Hits 29015 29063 +48
- Misses 2274 2277 +3 🚀 New features to boost your workflow:
|
Regressions detected 🔴 * No develop baseline was found for this PR's branch point; compared against the latest available develop run instead. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Modifies some of our existing tests to work properly with pytest.
Technical Details
By default, pytest picks up any functions in the format of
test_*or*_testand runs them as tests. This PR adds an underscore prefix to any functions that are meant to be helpers and not actual tests.Changelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable