-
Notifications
You must be signed in to change notification settings - Fork 89
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
Introduce fairseq2n pytest marker #83
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,12 @@ | |
from fairseq2.data import DataPipeline, read_sequence | ||
from fairseq2.data.text.text_reader import read_text | ||
from fairseq2.utils.version import is_pt2_or_greater | ||
from tests.common import python_devel_only, tmp_rng_seed | ||
from tests.common import tmp_rng_seed | ||
|
||
cpu_device = torch.device("cpu") | ||
|
||
|
||
@pytest.mark.skipif( | ||
python_devel_only(), | ||
reason="New fairseq2n API in Python-only installation. Skipping till v0.2.", | ||
) | ||
@pytest.mark.fairseq2n("0.2a0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to have a custom pytest marks?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH no particular reason. I just followed the instructions here: https://docs.pytest.org/en/7.1.x/example/markers.html. Looks like one advantage of using a pytest marker is that it integrates your marker with the pytest CLI (described here). It also makes it possible to use a marker in parametrized tests. Let me know if you have any objection on using a pytest marker though. I don't have a strong opinion on this. |
||
@pytest.mark.skipif( | ||
not is_pt2_or_greater(), | ||
reason="Different sampling results with versions lower than PyTorch 2.0", | ||
|
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.
if we end up using custom marks can we have a link to documentation ? https://docs.pytest.org/en/stable/reference/reference.html#custom-marks
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.
Yep. I just realized that I should also update the contribution guidelines and mention this annotation there.