-
Notifications
You must be signed in to change notification settings - Fork 7k
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
use pytest markers instead of custom solution for prototype transforms functional tests #6653
Conversation
…s functional tests
test_marks: Sequence[TestMark] = dataclasses.field(default_factory=list) | ||
_test_marks_map: Dict[str, List[TestMark]] = dataclasses.field(default=None, init=False) | ||
|
||
def __post_init__(self): | ||
self._skips_map = {skip.test_name: skip for skip in self.skips} | ||
test_marks_map = defaultdict(list) | ||
for test_mark in self.test_marks: | ||
test_marks_map[test_mark.test_id].append(test_mark) | ||
self._test_marks_map = dict(test_marks_map) |
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.
This is the same on KernelInfo
and here on the DispatcherInfo
. I'm going to factor this out into a common base class in a follow-up PR since this PR is already quite large.
|
||
import numpy as np | ||
import pytest | ||
import torch.testing | ||
import torchvision.ops | ||
import torchvision.prototype.transforms.functional as F | ||
|
||
from _pytest.mark.structures import MarkDecorator |
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.
This is only needed for annotating the attributes of the data classes below. I'll send a follow-up PR removing them, since the upside of @dataclasses.dataclass
is outweighed by the downside of importing from a private namespace.
@@ -17,11 +20,24 @@ | |||
__all__ = ["KernelInfo", "KERNEL_INFOS"] | |||
|
|||
|
|||
TestID = Tuple[Optional[str], str] |
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.
Same as above.
Conflicts: test/prototype_transforms_dispatcher_infos.py test/prototype_transforms_kernel_infos.py test/test_prototype_transforms_functional.py
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 @pmeier
…transforms functional tests (#6653) Summary: * use pytest markers instead of custom solution for prototype transforms functional tests * cleanup * cleanup * trigger CI Reviewed By: datumbox Differential Revision: D40138744 fbshipit-source-id: b2a51d258eaacd348c3b2004591455ed88aac927
In #6626 we added support for skipping tests through the
KernelInfo
andDispatcherInfo
. It was a custom solution that relied on some fixture magicvision/test/test_prototype_transforms_functional.py
Lines 29 to 35 in 55a436c
Plus, there were other downsides:
This PR changes this by replacing our custom skip logic with the ability to add
pytest.mark
's to a specificinfo
/args_kwargs
combination.