-
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
Port test_ops.py to pytest #3953
Conversation
@pytest.mark.parametrize('device', cpu_and_gpu()) | ||
@pytest.mark.parametrize('contiguous', (True, False)) | ||
def test_forward(self, device, contiguous, x_dtype=None, rois_dtype=None, **kwargs): |
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.
The previously manual cross-product between device and contiguous is now seamlessly handled by the parametrization, both for test_forward
and test_backward
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.
Looking good @NicolasHug. Two comments:
- Can we declare
RoIOpTester
anabc.ABC
and mark the abstract methods as such? Makes it easier to read and catches errors faster if we need to add a new test case. - Can the
_test_boxes_shape
merged into the base class with the same pattern as the other tests?
Thanks for the review @pmeier ! Your comments were addressed :)
Yeah it was a bit weird. I just kept @cpu_only
def test_boxes_shape(self):
self._helper_boxes_shape(ops.roi_pool) |
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, thanks @NicolasHug!
Reviewed By: NicolasHug Differential Revision: D29027309 fbshipit-source-id: 7704b4e86a7f476f405a981112b73677d0bff16c
This PR ports the entire
test_ops.py
file to pytest. It went pretty smoothly considering the size of the file, as the class structure already in place really helped.The diff looks a bit big but it's mainly because I parametrized some methods, so the indentation of the (now removed) for loops isn't here anymore.
The rest is just adding a bunch of decorators and changing class names so that they're properly discovered by pytest