diff --git a/e2e/binary/install/BUILD.bazel b/e2e/binary/install/BUILD.bazel index d8a75915b45272c590b2dadf636526f196afe0c0..e4e6ef5c4f162c542608f0c8da982bed9b91ad15 100644 --- a/e2e/binary/install/BUILD.bazel +++ b/e2e/binary/install/BUILD.bazel @@ -1,11 +1,31 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") +load("@bazel_skylib//rules:native_binary.bzl", "native_test") -# TODO: write an _actual_ test for `install` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["install.py"], + data = [ + "fixture.txt", + "@ape//ape:install", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "install", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:install"], + src = "@ape//ape:install", + args = ["--version"], +) + +test_suite( + name = "install", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/install/fixture.txt b/e2e/binary/install/fixture.txt new file mode 100644 index 0000000000000000000000000000000000000000..b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0 --- /dev/null +++ b/e2e/binary/install/fixture.txt @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/e2e/binary/install/install.py b/e2e/binary/install/install.py new file mode 100644 index 0000000000000000000000000000000000000000..0d6c17a1350da87dba81a58d5186da1a013092b3 --- /dev/null +++ b/e2e/binary/install/install.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_install(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("install") + fixture = relative("fixture.txt") + output = tmp_path / "output.txt" + + cmd = (binary, fixture, output,) + run(cmd, check=True, timeout=30) + + assert Diff(fixture) == Diff(output)