From ba82c4ece36ddd7d07a004b9b1813d9b1c54648e Mon Sep 17 00:00:00 2001 From: Mathias Laurin Date: Thu, 26 Sep 2024 13:28:00 +0200 Subject: [PATCH] Let bazel py_test use the local pyproject.toml CMK-19117 Change-Id: I198cd0d78324f1e488e78511e412389b7f3f70e8 --- packages/cmk-agent-based/BUILD | 9 ++++----- packages/cmk-werks/BUILD | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/cmk-agent-based/BUILD b/packages/cmk-agent-based/BUILD index 349aee408a9..77e32a5d882 100644 --- a/packages/cmk-agent-based/BUILD +++ b/packages/cmk-agent-based/BUILD @@ -5,6 +5,8 @@ load("@omd_packages//omd/packages/rules:package_wheel.bzl", "package_wheel") load("@rules_python//python:packaging.bzl", "py_wheel") load("@rules_python//python:pip.bzl", "compile_pip_requirements") +exports_files(["pyproject.toml"]) + compile_pip_requirements( name = "requirements", requirements_in = "pyproject.toml", @@ -49,11 +51,8 @@ py_pytest_main( py_test( name = "unit", srcs = glob(["tests/**/*.py"]) + [":__test__.py"], - # TODO: Duplicated from pyproject.toml - args = [ - "--import-mode=importlib", - "--doctest-modules", - ], + args = ["--config-file=$(location pyproject.toml)"], + data = ["pyproject.toml"], imports = ["."], main = ":__test__.py", deps = [ diff --git a/packages/cmk-werks/BUILD b/packages/cmk-werks/BUILD index cee3d501d2a..f52cda9034c 100644 --- a/packages/cmk-werks/BUILD +++ b/packages/cmk-werks/BUILD @@ -4,6 +4,8 @@ load("@omd_packages//omd/packages/rules:package_wheel.bzl", "package_wheel") load("@rules_python//python:packaging.bzl", "py_wheel") load("@rules_python//python:pip.bzl", "compile_pip_requirements") +exports_files(["pyproject.toml"]) + compile_pip_requirements( name = "requirements", requirements_in = "pyproject.toml", @@ -43,11 +45,8 @@ py_pytest_main( py_test( name = "unit", srcs = glob(["tests/**/*.py"]) + [":__test__.py"], - # TODO: Duplicated from pyproject.toml - args = [ - "--import-mode=importlib", - "--doctest-modules", - ], + args = ["--config-file=$(location pyproject.toml)"], + data = ["pyproject.toml"], imports = ["."], main = ":__test__.py", deps = [