use pytest markers instead of custom solution for prototype transforms functional tests#6653
Merged
pmeier merged 6 commits intopytorch:mainfrom Oct 5, 2022
Merged
Conversation
…s functional tests
pmeier
commented
Sep 27, 2022
Comment on lines
+23
to
+30
| 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) |
Contributor
Author
There was a problem hiding this comment.
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 torchvision.ops | ||
| import torchvision.prototype.transforms.functional as F | ||
|
|
||
| from _pytest.mark.structures import MarkDecorator |
Contributor
Author
There was a problem hiding this comment.
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.
| __all__ = ["KernelInfo", "KERNEL_INFOS"] | ||
|
|
||
|
|
||
| TestID = Tuple[Optional[str], str] |
Conflicts: test/prototype_transforms_dispatcher_infos.py test/prototype_transforms_kernel_infos.py test/test_prototype_transforms_functional.py
vfdev-5
approved these changes
Oct 5, 2022
facebook-github-bot
pushed a commit
that referenced
this pull request
Oct 7, 2022
…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
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.
In #6626 we added support for skipping tests through the
KernelInfoandDispatcherInfo. 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_kwargscombination.