Skip to content

gazelle: generate py_pytest_main #1972

@alexeagle

Description

@alexeagle

Related to pytest support #240

The outcome of #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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions