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

Rewrite unittest.main() with sys.exit(pytest.main([__file__])) #44

Open
verhovsky opened this issue Mar 6, 2020 · 0 comments
Open

Rewrite unittest.main() with sys.exit(pytest.main([__file__])) #44

verhovsky opened this issue Mar 6, 2020 · 0 comments

Comments

@verhovsky
Copy link

I'm using pytest with bazel. To get bazel to pick up the fact that a pytest test has failed you need to put this at the end of every *_test.py file:

if __name__ == "__main__":
    sys.exit(pytest.main([__file__]))

(See bazelbuild/rules_python#240 )

It would be nice if this tool had an option to change the unittest-based snippet

if __name__ == "__main__":
    unittest.main()

with the pytest one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant