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

Refactor test_transforms.py into classes #4030

Merged
merged 8 commits into from
Jun 15, 2021

Conversation

AnirudhDagar
Copy link
Contributor

This is a follow-up PR as discussed here (#3982 comment) after porting of unittest to pytest. See #3945

@NicolasHug I apologize for the unusually large diff in this single PR, but there is no logical change other than a few that I'll explicitly mark. Please let me know if I can help in getting this reviewed in any possible way.

Copy link
Contributor Author

@AnirudhDagar AnirudhDagar left a comment

Choose a reason for hiding this comment

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

Also just to make sure the tests themselves remain unchanged.

For test_transforms.py,
Before this PR : 886 tests passed 5 skipped.
After this PR : (EDIT) 886 tests passed 5 skipped.

test/test_transforms.py Outdated Show resolved Hide resolved
test/test_transforms.py Outdated Show resolved Hide resolved
test/test_transforms.py Outdated Show resolved Hide resolved
test/test_transforms.py Outdated Show resolved Hide resolved
test/test_transforms.py Outdated Show resolved Hide resolved
test/test_transforms.py Outdated Show resolved Hide resolved
@AnirudhDagar
Copy link
Contributor Author

@NicolasHug Please take a look whenever you have some time. Thanks :))

Copy link
Member

@NicolasHug NicolasHug 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 the PR @AnirudhDagar

I see the value in grouping the "to tensor" and the "to pil" tests into their respective classes.
For other cases though it's not as obvious. For example, it's not obvious whether test_randomresized_params should be in TestResize or in TestRandomX.

Since moving tests around does come with the cost of adding an extra step in the git blame (which isn't negligible when it comes to maintenance), I'd suggest to only keep the TestToTensor and TestToPil classes for now.

Hopefully this will also reduce the size of the PR, making it easier to review. I'm happy to consider further changes in the future (I can't promise they'll be merged though), but I'd suggest to leave that for other PRs.

@AnirudhDagar
Copy link
Contributor Author

Thanks for the feedback @NicolasHug! I had a similar doubt as well while grouping a few tests. I also understand your very valid point on git blame and maintenance.

As suggested, I'll update the PR to include TestToTensor and TestToPil only for now.

@AnirudhDagar
Copy link
Contributor Author

@NicolasHug I've made the changes, hopefully now the PR should be manageable for a review. Tests are all green as well! :)

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

thanks @AnirudhDagar

@NicolasHug NicolasHug merged commit 34a8a37 into pytorch:master Jun 15, 2021
@NicolasHug
Copy link
Member

For the rest I think the only really obvious ones would be to group the test_adjust ones, but even then I don't see a strong incentive to do so, as they all test different transforms after all. So I feel like we can leave the rest as-is.

Thanks a ton for your work @AnirudhDagar !

@AnirudhDagar
Copy link
Contributor Author

Thanks for your valuable feedback and detailed reviews @NicolasHug ! Let me know if there are any other issues where I can help.

Ps. I'll try to work on re-enabling the broken cpp tests (mnasnet specifically) over the weekend.

@NicolasHug
Copy link
Member

If you're interested, #4063 is not taken yet ;)

facebook-github-bot pushed a commit that referenced this pull request Jun 21, 2021
Reviewed By: fmassa

Differential Revision: D29264315

fbshipit-source-id: 299ef84e1f91049af3e05be185a5578e6327f410
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.

3 participants