diff --git a/e2e/binary/numfmt/BUILD.bazel b/e2e/binary/numfmt/BUILD.bazel index 386ea98a852b36702508982ce6f98a7074bd2488..cc2898eaf6e2030f26468220061419b873472e8f 100644 --- a/e2e/binary/numfmt/BUILD.bazel +++ b/e2e/binary/numfmt/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 `numfmt` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["format.py"], + data = [ + "@ape//ape:numfmt", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "numfmt", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:numfmt"], + src = "@ape//ape:numfmt", + args = ["--version"], +) + +test_suite( + name = "numfmt", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/numfmt/format.py b/e2e/binary/numfmt/format.py new file mode 100644 index 0000000000000000000000000000000000000000..2402011025d3bdbead5b609845f1b2be04a5eaec --- /dev/null +++ b/e2e/binary/numfmt/format.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +from subprocess import PIPE, run + +from binary import Tool + + +def test_format(tool: Tool) -> None: + tool = tool("numfmt") + cmd = (tool, "--to=si", "1000") + r = run(cmd, stdout=PIPE, encoding="utf8") + assert r.returncode == 0, r.stdout + assert r.stdout.rstrip() == "1.0K"