diff --git a/e2e/binary/true/BUILD.bazel b/e2e/binary/true/BUILD.bazel index 7fde5ecb79b4028f994a186e7d3f3274d18bd3c1..8196cf07b3d8bf498a88f3041058d0e29f0ad7b4 100644 --- a/e2e/binary/true/BUILD.bazel +++ b/e2e/binary/true/BUILD.bazel @@ -1,11 +1,30 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@bazel_skylib//rules:native_binary.bzl", "native_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") -# TODO: write an _actual_ test for `true` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["true.py"], + data = [ + "@ape//ape:true", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "true", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:true"], + src = "@ape//ape:true", + args = ["--version"], +) + +test_suite( + name = "true", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/true/true.py b/e2e/binary/true/true.py new file mode 100644 index 0000000000000000000000000000000000000000..84a9ab628783efb10d2be422c963bf7275b412ca --- /dev/null +++ b/e2e/binary/true/true.py @@ -0,0 +1,14 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Relative, Tool + + +def test_true(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("true") + + cmd = (binary, "Hello, world!") + result = run(cmd, timeout=30, capture_output=True, text=True) + assert result.stdout.returncode() == 0