Skip to content

Commit 218a202

Browse files
authored
Add testonly and data parameters to py_pytest_main rule (#190)
### Type of change - New feature or functionality (change which adds functionality) Adds 2 new **optional** parameters to `py_pytest_main(...)` rule: `data` and `testonly`. These are standard arguments to the `py_library`. This change simply exposes the arguments to the `py_pytest_main` rule closes: #189 ### Test plan - Covered by existing test cases
1 parent 901405b commit 218a202

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

docs/rules.md

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

py/private/py_pytest_main.bzl

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ _py_pytest_main = rule(
5353
},
5454
)
5555

56-
def py_pytest_main(name, py_library = default_py_library, deps = [], **kwargs):
56+
def py_pytest_main(name, py_library = default_py_library, deps = [], data = [], testonly = True, **kwargs):
5757
"""py_pytest_main wraps the template rendering target and the final py_library.
5858
5959
Args:
6060
name: The name of the runable target that updates the test entry file.
6161
py_library: Use this attribute to override the default py_library rule.
6262
deps: A list containing the pytest library target, e.g., @pypi_pytest//:pkg.
63+
data: A list of data dependencies to pass to the py_library target.
64+
testonly: A boolean indicating if the py_library target is testonly.
6365
**kwargs: The extra arguments passed to the template rendering target.
6466
"""
6567

@@ -77,8 +79,10 @@ def py_pytest_main(name, py_library = default_py_library, deps = [], **kwargs):
7779

7880
py_library(
7981
name = name,
82+
testonly = testonly,
8083
srcs = [test_main],
8184
tags = tags,
8285
visibility = visibility,
8386
deps = deps,
87+
data = data,
8488
)

0 commit comments

Comments
 (0)