diff --git a/e2e/binary/test/BUILD.bazel b/e2e/binary/test/BUILD.bazel index 0dcf8ba0c4000058d28f4de57c46c4ab2caab9e6..940112b15d7b2ad8b242bcc2311f382f28073f8e 100644 --- a/e2e/binary/test/BUILD.bazel +++ b/e2e/binary/test/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 `test` -build_test( - name = "test", +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["test.py"], + data = [ + "@ape//ape:test" + ], + deps = [ + "//binary:pytest", + ], +) + +native_test( + name = "native", size = "small", - tags = ["stub"], - targets = ["@ape//ape:test"], + src = "@ape//ape:test", + args = ["hello"], +) + +test_suite( + name = "test", + tests = [ + "native", + "pytest", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/test/test.py b/e2e/binary/test/test.py new file mode 100644 index 0000000000000000000000000000000000000000..6ffabf0671719b2735e1b8eb8c448d3bfbd8e493 --- /dev/null +++ b/e2e/binary/test/test.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from subprocess import run, CalledProcessError +import pytest + +from binary.tool import Tool + + +def test_strings_equal(tool: Tool) -> None: + binary = tool("test") + + cmd = (binary, 'hello', '=', 'hello') + run(cmd, check=True, timeout=30) + + +def test_strings_unequal(tool: Tool) -> None: + binary = tool("test") + + cmd = (binary, 'hello', '=', 'bye') + with pytest.raises(CalledProcessError): + run(cmd, check=True, timeout=30)