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

NOMRG refactor test_models to use pytest #3528

Closed
wants to merge 5 commits into from

Conversation

NicolasHug
Copy link
Member

Just a small POC

@fmassa, this is how we could factorize test_models if we relied on pytest. In fact we could factorize much more and get rid of the unittest.TestCase dependency, but this would be more work.

test/test_models.py Outdated Show resolved Hide resolved

if __name__ == '__main__':
unittest.main()
pytest.main([__file__])
Copy link
Member Author

Choose a reason for hiding this comment

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

This allows to preserve the use of python tests/test_models.py

Most packages don't do this and just rely on calling pytest or python -m pytest from the command line instead of python.

@codecov
Copy link

codecov bot commented Mar 8, 2021

Codecov Report

Merging #3528 (fff4683) into master (414427d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3528   +/-   ##
=======================================
  Coverage   78.75%   78.75%           
=======================================
  Files         105      105           
  Lines        9748     9748           
  Branches     1565     1565           
=======================================
  Hits         7677     7677           
  Misses       1581     1581           
  Partials      490      490           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 414427d...fff4683. Read the comment docs.

@datumbox
Copy link
Contributor

datumbox commented Mar 8, 2021

@pmeier you might be interested in this.

@NicolasHug
Copy link
Member Author

@pmeier you might be interested in this.

For context this is just a POC where I'm trying to showcase the benefits of using pytest in torchvision (#3505 is another one with parameterized). There's still a lot of work/discussion to do before we can start adopting pytest for good. I'm currently working on making it run internally on fb. I'll keep updated on my progress but it's still very preliminary.

@NicolasHug
Copy link
Member Author

Closing in favor of #3697

@NicolasHug NicolasHug closed this Apr 20, 2021
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