diff --git a/MODULE.bazel b/MODULE.bazel index df27b2a..2d84656 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,7 +16,7 @@ module( name = "score_test_scenarios", - version = "0.3.1", + version = "0.3.2", compatibility_level = 0, ) diff --git a/pyproject.toml b/pyproject.toml index 6b284ce..94f5557 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "testing-utils" -version = "0.3.1" +version = "0.3.2" dependencies = ["pytest>=8.3.5", "pytest-html>=4.1.1", "pytest-repeat>=0.9.4"] requires-python = ">=3.12" authors = [ diff --git a/testing_utils/build_tools.py b/testing_utils/build_tools.py index 1585ade..5b63499 100644 --- a/testing_utils/build_tools.py +++ b/testing_utils/build_tools.py @@ -335,7 +335,7 @@ def find_target_path(self, target_name: str, *, expect_exists: bool = True) -> P return target_path - def build(self, target_name: str) -> Path: + def build(self, target_name: str, *options) -> Path: """ Run build for selected target. @@ -345,7 +345,7 @@ def build(self, target_name: str) -> Path: Name of the target to build. """ # Run build. - command = ["bazel", "build", target_name] + command = ["bazel", "build", target_name, *options] with Popen(command, text=True) as p: _, _ = p.communicate(timeout=self.build_timeout) if p.returncode != 0: diff --git a/tests/test_build_tools.py b/tests/test_build_tools.py index 4f90959..8f76f21 100644 --- a/tests/test_build_tools.py +++ b/tests/test_build_tools.py @@ -472,4 +472,13 @@ def expected_target_path(self, tmp_project: tuple[str, Path]) -> Path: target_name, project_path = tmp_project return project_path / "bazel-out" / "k8-fastbuild" / "bin" / target_name + def test_build_additional_params(self, tools_type: type[BuildTools], tmp_project: tuple[str, Path]) -> None: + target_name, path = tmp_project + with cwd(path): + tools = tools_type() + target_path = tools.build(target_name, "--verbose_failures", "--action_env=TEST_VAR=TEST_VALUE") + + # Check executable exists. + assert target_path.exists() + # TODO: add query tests. # noqa: FIX002