Skip to content

gazelle: generate py_pytest_main #1972

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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