Skip to content

Commit 1dc4409

Browse files
committed
example: improve basic test
note: on windows deps[:basic] in basic_test may fail while basic_lib_test work
1 parent 9017093 commit 1dc4409

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

examples/basic/BUILD.bazel

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,28 @@ pybind_extension(
88
srcs = ["basic.cpp"],
99
)
1010

11+
py_test(
12+
name = "basic_pybind_data_test",
13+
size="small",
14+
srcs = ["basic_test.py"],
15+
main = "basic_test.py",
16+
data = [":basic"],
17+
)
18+
19+
py_test(
20+
name = "basic_pybind_deps_test",
21+
size="small",
22+
srcs = ["basic_test.py"],
23+
main = "basic_test.py",
24+
deps = [":basic"],
25+
)
26+
27+
# this seems to work as expected
28+
# the basic.so is in the wheel package
1129
py_wheel(
12-
name = "basic_wheel",
30+
name = "basic_pybind_wheel",
1331
testonly = True,
14-
distribution = "basic",
32+
distribution = "basic_pybind",
1533
version = "1.0.0",
1634
deps = [":basic"],
1735
)
@@ -22,17 +40,19 @@ py_library(
2240
imports = ["."],
2341
)
2442

43+
py_test(
44+
name = "basic_lib_test",
45+
size="small",
46+
srcs = ["basic_test.py"],
47+
main = "basic_test.py",
48+
deps = [":basic_lib"],
49+
)
50+
51+
# this won't contains the basic.so native module
2552
py_wheel(
2653
name = "basic_lib_wheel",
2754
testonly = True,
2855
distribution = "basic_lib",
29-
version = "1.0.0",
56+
version = "2.0.0",
3057
deps = [":basic_lib"],
3158
)
32-
33-
py_test(
34-
name = "basic_test",
35-
size="small",
36-
srcs = ["basic_test.py"],
37-
deps = [":basic_lib"],
38-
)

0 commit comments

Comments
 (0)