Added py_test rule to Bazel
py_test rule enable to use a test written in Python. A py_test is
basically a py_binary that returns a non null on failure. Extraneous
support is need to have nice output (see //src/test/shell/unittest.bash
for the kind of support neeeded).
Actually the py_test code was already there but it was just missing the
necessary glue code. Also added an integration test for py_* rules in
Bazel.
--
MOS_MIGRATED_REVID=91407748
diff --git a/examples/py_native/BUILD b/examples/py_native/BUILD
index 3d8de94..d6fdfa9 100644
--- a/examples/py_native/BUILD
+++ b/examples/py_native/BUILD
@@ -1,3 +1,9 @@
+filegroup(
+ name = "srcs",
+ srcs = glob(["*.py"]) + ["BUILD"],
+ visibility = ["//examples:__pkg__"],
+)
+
py_binary(
name = "bin",
srcs = ["bin.py"],
@@ -8,3 +14,15 @@
name = "lib",
srcs = ["lib.py"],
)
+
+py_test(
+ name = "test",
+ srcs = ["test.py"],
+ deps = [":lib"],
+)
+
+py_test(
+ name = "fail",
+ srcs = ["fail.py"],
+ deps = [":lib"],
+)