-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Docs] Added documentation on pytest target parametrization. #8638
Conversation
@mbrookhart The documentation that we had discussed, describing how tests can be run across multiple targets. @hogepodge I have this in the |
Follow-up from apache#8542, to document existing features.
b19acc1
to
64fb75d
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.
Thanks for all the hard work @Lunderberg!
Given that this document is intended for people who are going to write tests, I'd first specify how they should write the tests and then talk about how it actually works. I.e. put all the parameterize_targets and requires_ stuff first.
- ``@pytest.mark.gpu`` - Tags a function as using GPU | ||
capabilities. This has no effect on its own, but can be paired with | ||
command-line arguments ``-m gpu`` or ``-m 'not gpu'`` to restrict | ||
which tests pytest will executed. Typically not called on its own. |
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.
I'd specify that developers should never use this mark explicitly.
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.
Sounds good, change made.
which tests pytest will executed. Typically not called on its own. | ||
|
||
- ``@tvm.testing.uses_gpu`` - Applies ``@pytest.mark.gpu``. Needed | ||
only for tests that explicitly loop over |
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.
Suggest that this is what should be used to mark tests requiring GPUs, but prefer parameterize_targets.
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.
Sounds good, change made.
|
||
.. code-block:: python | ||
|
||
# Old style, not recommend anymore |
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.
I'd prefer saying "do not use" vs "not recommended".
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.
Sounds good, change made.
|
||
.. code-block:: python | ||
|
||
# New style, implicitly parametrized to run on all |
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.
I thin you can remove all the new style comments given that this document is intended for how people should write targets now.
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.
Sounds good, change made.
@tkonolige All requested changes are made, how does it look now? |
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.
When @tkonolige signs off feel free to merge @Lunderberg
Thanks @Lunderberg. All looks good to me. |
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.
LGTM
Oh sorry @tkonolige I merged this because I saw others approving. Do you mind if we deal with any changes you might require, in follow-up patches? |
This is merged now, thanks @jroesch @hogepodge @Lunderberg and @tkonolige! |
@tkonolige and I had some follow-up discussion on moving the recommended style to the top, with the explanation of how it works and why that style is preferred underneath. That way, it is better suited for developers writing/debugging tests, who would primarily want to know what to write, but don't want to get bogged down in the how/why. Since this one is merged, I'll add it in an additional PR. |
…8638) * [Docs] Added documentation on pytest target parametrization. Follow-up from apache#8542, to document existing features. * [Docs] Updated pytest parametrization documentation following review Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
…8638) * [Docs] Added documentation on pytest target parametrization. Follow-up from apache#8542, to document existing features. * [Docs] Updated pytest parametrization documentation following review Co-authored-by: Eric Lunderberg <elunderberg@octoml.ai>
Follow-up from #8542, to document existing features.