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

Add pytest_test support to rules_python. #243

Closed
wants to merge 6 commits into from
Closed

Add pytest_test support to rules_python. #243

wants to merge 6 commits into from

Conversation

pstradomski
Copy link
Collaborator

@edbaunton
Copy link
Contributor

Is this something that could be reviewed and merged some time soon? We would love to use pytest with Bazel!

@ali5h
Copy link

ali5h commented Jan 15, 2020

i personally don't think this should be part of rules_python. With a simple macro you can achieve this, check this as an example https://github.com/ali5h/rules_pip/blob/master/defs.bzl

@thundergolfer
Copy link
Collaborator

thundergolfer commented Jan 15, 2020

We already use PyTest with Bazel. It works with the standard py_test rule if you add the following snippet to the file run as main.

import pytest
import os
import sys 

...

if __name__ == "__main__":
    dir_path = os.path.dirname(os.path.realpath(__file__))
    sys.exit(pytest.main([dir_path, "-W", "ignore::DeprecationWarning"]))

Compared with other issues we have in our Python-Bazel codebase, this is a minor annoyance.

@pstradomski
Copy link
Collaborator Author

Withdrawing as it seems there's no consensus this is the right approach.

@pstradomski pstradomski closed this May 3, 2020
@peloton-mqiu
Copy link

peloton-mqiu commented Sep 28, 2020

https://github.com/ali5h/rules_pip/blob/master/defs.bzl#L139

Hi @ali5h ,
is the link you shared still points to the line you originally intended?
master seems to have advanced, probably you are referring to this rule

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

Successfully merging this pull request may close these issues.

pytest support
6 participants