diff --git a/e2e/binary/echo/BUILD.bazel b/e2e/binary/echo/BUILD.bazel index ff802ed92ff447c251683fd6a68ea9b68b228479..80f8100c18f13306f3c5eed07515fc17c61efab8 100644 --- a/e2e/binary/echo/BUILD.bazel +++ b/e2e/binary/echo/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 `echo` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["echo.py"], + data = [ + "@ape//ape:echo", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "echo", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:echo"], + src = "@ape//ape:echo", + args = ["--version"], +) + +test_suite( + name = "echo", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/echo/echo.py b/e2e/binary/echo/echo.py new file mode 100644 index 0000000000000000000000000000000000000000..b2f32619424c78b01eea8d8166f17dd8ae196411 --- /dev/null +++ b/e2e/binary/echo/echo.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from subprocess import run +from binary import Tool + + +def test_echo(tool: Tool) -> None: + binary = tool("echo") + + cmd = (binary, "Hello, world!") + result = run(cmd, check=True, timeout=30, capture_output=True, text=True) + assert result.stdout.rstrip() == "Hello, world!"