From cb7dfe7b9e0d68c5e5600f1e1e368a1e0e66457e Mon Sep 17 00:00:00 2001 From: Luke Hackwell Date: Fri, 28 Feb 2025 11:15:47 +0000 Subject: [PATCH] test(romanize): add pytest e2e test --- e2e/binary/romanize/BUILD.bazel | 22 ++++++++++++++++------ e2e/binary/romanize/romanize.py | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 e2e/binary/romanize/romanize.py diff --git a/e2e/binary/romanize/BUILD.bazel b/e2e/binary/romanize/BUILD.bazel index 25900815..4f154e1b 100644 --- a/e2e/binary/romanize/BUILD.bazel +++ b/e2e/binary/romanize/BUILD.bazel @@ -1,11 +1,21 @@ -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 `romanize` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["romanize.py"], + data = [ + "@ape//ape:romanize", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( +test_suite( name = "romanize", - size = "small", - tags = ["stub"], - targets = ["@ape//ape:romanize"], + tests = [ + "pytest", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/romanize/romanize.py b/e2e/binary/romanize/romanize.py new file mode 100644 index 00000000..3798f08b --- /dev/null +++ b/e2e/binary/romanize/romanize.py @@ -0,0 +1,15 @@ +from __future__ import annotations + +from subprocess import run + +from binary.tool import Tool + + +def test_romanize(tool: Tool) -> None: + binary = tool("romanize") + + cmd = (binary) + stdin = 'Mjød' + result = run(cmd, check=True, timeout=30, input=stdin, capture_output=True, text=True) + + assert result.stdout == 'MJOED' -- GitLab