rules_python
rules_python copied to clipboard
gazelle: generate py_pytest_main
Related to pytest support #240
The outcome of https://github.com/bazelbuild/rules_python/pull/723 is that pytest-specifics landed in other repos. https://github.com/caseyduquettesc/rules_python_pytest and https://github.com/aspect-build/rules_py/blob/main/docs/rules.md#py_pytest_main are a couple examples of code generators that create the entrypoint file that shims between py_test#entry_point and what pytest expects to run.
[!WARNING] Note, without the shim,
py_test(srcs=["some.pytest.test.py"])silently passes without running any tests!
The something added in this test case https://github.com/bazelbuild/rules_python/blob/main/gazelle/python/testdata/generated_test_entrypoint/BUILD.out#L3 alludes to the real problem, which is that gazelle knows to use that __test__.py as the entrypoint, but doesn't know how to generate the something.
It should generate a py_pytest_main, allowing users to control via map_kind which ruleset they'd like to use to provide that rule.