From 9534d27d813b5d8866942232b7c1e028b7ba85be Mon Sep 17 00:00:00 2001 From: Jonathan Watson Date: Mon, 17 Feb 2025 17:02:33 +0000 Subject: [PATCH] test(join): add version and join test --- e2e/binary/join/BUILD.bazel | 33 +++++++++++++++++++++++++++------ e2e/binary/join/file1.txt | 6 ++++++ e2e/binary/join/file2.txt | 6 ++++++ e2e/binary/join/join.py | 21 +++++++++++++++++++++ 4 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 e2e/binary/join/file1.txt create mode 100644 e2e/binary/join/file2.txt create mode 100644 e2e/binary/join/join.py diff --git a/e2e/binary/join/BUILD.bazel b/e2e/binary/join/BUILD.bazel index 8dfb39f8..2dcb4c8b 100644 --- a/e2e/binary/join/BUILD.bazel +++ b/e2e/binary/join/BUILD.bazel @@ -1,11 +1,32 @@ -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 `join` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["join.py"], + data = [ + "@ape//ape:join", + ":file1.txt", + ":file2.txt", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "join", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:join"], + src = "@ape//ape:join", + args = ["--version"], +) + +test_suite( + name = "join", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/join/file1.txt b/e2e/binary/join/file1.txt new file mode 100644 index 00000000..f37e4ce1 --- /dev/null +++ b/e2e/binary/join/file1.txt @@ -0,0 +1,6 @@ +1 One +2 Two +3 Three +4 Four +5 Five +6 Six diff --git a/e2e/binary/join/file2.txt b/e2e/binary/join/file2.txt new file mode 100644 index 00000000..92d348a2 --- /dev/null +++ b/e2e/binary/join/file2.txt @@ -0,0 +1,6 @@ +1 Dogs +2 Hippos +3 Cats +4 Birds +5 Mice +7 Pandas diff --git a/e2e/binary/join/join.py b/e2e/binary/join/join.py new file mode 100644 index 00000000..528d6e8a --- /dev/null +++ b/e2e/binary/join/join.py @@ -0,0 +1,21 @@ +from __future__ import annotations + +from subprocess import run + +from binary.tool import Tool +from binary import Relative + + +def test_join(tool: Tool, relative: Relative) -> None: + binary = tool("join") + file1 = relative("file1.txt") + file2 = relative("file2.txt") + + cmd = (binary, file1, file2) + result = run(cmd, check=True, timeout=30, capture_output=True, text=True) + assert """1 One Dogs +2 Two Hippos +3 Three Cats +4 Four Birds +5 Five Mice +""" == result.stdout -- GitLab