-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdefs.bzl
More file actions
37 lines (33 loc) · 908 Bytes
/
Copy pathdefs.bzl
File metadata and controls
37 lines (33 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Public API"""
load("@rules_python//python:defs.bzl", "py_test")
load("@pytest_requirements//:requirements.bzl", "requirement")
def py_pytest_test(name, srcs, deps = [], args = [], **kwargs):
"""Use pytest to run tests, using a wrapper script to interface with Bazel.
```py
py_pytest_test(
name = "test_w_pytest",
size = "small",
srcs = ["test.py"],
deps = [
],
)
```
"""
shim_label = Label("//python_pytest:pytest_shim.py")
py_test(
name = name,
srcs = [
shim_label,
] + srcs,
main = shim_label,
args = [
"--capture=no",
] + args + ["$(location :%s)" % x for x in srcs],
# python_version = "PY3",
# srcs_version = "PY3",
deps = deps + [
requirement("pytest"),
requirement("pluggy"),
],
**kwargs
)