Skip to content
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

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

Lunderberg
Copy link
Contributor

Follow-up from #8542, to document existing features.

@Lunderberg
Copy link
Contributor Author

@mbrookhart The documentation that we had discussed, describing how tests can be run across multiple targets.

@hogepodge I have this in the dev section of the documentation, trying to follow your proposed re-organization of the documentation.

Follow-up from apache#8542, to document existing features.
Copy link
Contributor

@tkonolige tkonolige left a 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.
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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".

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, change made.

@Lunderberg
Copy link
Contributor Author

@tkonolige All requested changes are made, how does it look now?

Copy link
Member

@jroesch jroesch left a 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

@hogepodge
Copy link
Contributor

Thanks @Lunderberg. All looks good to me.

Copy link
Contributor

@leandron leandron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leandron leandron merged commit f5315ca into apache:main Aug 11, 2021
@leandron
Copy link
Contributor

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?

@leandron
Copy link
Contributor

This is merged now, thanks @jroesch @hogepodge @Lunderberg and @tkonolige!

@Lunderberg
Copy link
Contributor Author

@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.

@Lunderberg Lunderberg deleted the docs_parametrize_targets branch August 11, 2021 15:45
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
…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>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants