diff --git a/e2e/binary/unbourne/BUILD.bazel b/e2e/binary/unbourne/BUILD.bazel index 6f9d958d4d2ee6be25afe904ed710d0129077af7..ae3b2ef5255c9a021b5b93ce246d58ce40a7ac52 100644 --- a/e2e/binary/unbourne/BUILD.bazel +++ b/e2e/binary/unbourne/BUILD.bazel @@ -1,11 +1,22 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") -# TODO: write an _actual_ test for `unbourne` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["redirect.py"], + data = [ + "expected.txt", + "@ape//ape:unbourne", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( +test_suite( name = "unbourne", - size = "small", - tags = ["stub"], - targets = ["@ape//ape:unbourne"], + tests = [ + "pytest", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/unbourne/expected.txt b/e2e/binary/unbourne/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..ce013625030ba8dba906f756967f9e9ca394464a --- /dev/null +++ b/e2e/binary/unbourne/expected.txt @@ -0,0 +1 @@ +hello diff --git a/e2e/binary/unbourne/redirect.py b/e2e/binary/unbourne/redirect.py new file mode 100644 index 0000000000000000000000000000000000000000..8b873fc541d82c4470b131e506f3b056b493680e --- /dev/null +++ b/e2e/binary/unbourne/redirect.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_redirect(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("unbourne") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + stdin = f"echo hello > {str(output)}".encode() + cmd = (binary,) + res = run(cmd, check=True, timeout=30, input=stdin,) + + assert Diff(expected) == Diff(output)