From ced56130b049a27ea527042a2210d2d5a8e8b4dd Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Wed, 8 Apr 2026 12:02:45 +0200 Subject: [PATCH 1/8] Define how to run tests --- CONTRIBUTING.md | 13 ++++++++++++- run_tests.sh | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100755 run_tests.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17db874a..46a32d7b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,4 +49,15 @@ test/test.sh | Functional and unit test runner Submitting a patch and testing ------- -Before submitting any changes please make sure all tests and checks are passed, pylint doesn't show warnings on new code, and fill out the Pull Request template. If you are a new contributor, and the template is confusing, feel free to submit the PR and we will help you iron it out! On how to run or add a new test, please see [test/README.md](test/README.md). +Before submitting any changes please make sure all tests and checks are passed. + +You must run the following tests locally: +* `pylint .` +* `bazel test //...` +* `pytest test` + + +On how to run or add a new test, please see [test/README.md](test/README.md). + + +Finally, fill out the Pull Request template. If you are a new contributor, and the template is confusing, feel free to submit the PR and we will help you iron it out! diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..8287ade0 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# This script currently assumes that the user have set up their environment. +# This means users using bazelisk have set their bazel version. +# Either with the environment variable: USE_BAZEL_VERSION +# or with the .bazelversion file. +pylint . +bazel test //... +pytest test/ From 3ec6fd86e36baa8984b5711f4943fc15e42eecb8 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 5 May 2026 11:11:42 +0200 Subject: [PATCH 2/8] Define micromamba as defacto environment manager --- run_tests.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 8287ade0..58519a3a 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,8 +1,16 @@ #!/usr/bin/env bash -# This script currently assumes that the user have set up their environment. -# This means users using bazelisk have set their bazel version. -# Either with the environment variable: USE_BAZEL_VERSION -# or with the .bazelversion file. + +cleanup() { + # Very important + # reactivation of the mamba environment is not possible if skipped + bazel clean + micromamba deactivate +} + +trap cleanup EXIT + +source ./.ci/micromamba/init.sh + pylint . bazel test //... -pytest test/ +pytest test From 117adbf502df76994c2dd602acef6e91c616afcc Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 May 2026 17:03:19 +0200 Subject: [PATCH 3/8] Make micromamba more robust --- run_tests.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 58519a3a..58e80c54 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,16 +1,17 @@ #!/usr/bin/env bash +echo "Clean up previous micromamba environment" +chmod -R +w .ci/micromamba/micromamba/envs/dev +rm -rf .ci/micromamba/micromamba/envs/dev -cleanup() { - # Very important - # reactivation of the mamba environment is not possible if skipped - bazel clean - micromamba deactivate -} - -trap cleanup EXIT - +echo "Initialize micromamba environment..." source ./.ci/micromamba/init.sh +echo "Running pylint..." pylint . +echo "Running bazel test //..." bazel test //... +echo "Running pytest ..." pytest test + +echo "Exiting micromamba..." +micromamba deactivate From 6782206590e4bcb0def0f5e4ed74fb954c4e404e Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 May 2026 17:09:10 +0200 Subject: [PATCH 4/8] Move cleanup to micromamba init.sh --- .ci/micromamba/init.sh | 6 +++++- run_tests.sh | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.ci/micromamba/init.sh b/.ci/micromamba/init.sh index 50c6d950..2c280ab5 100644 --- a/.ci/micromamba/init.sh +++ b/.ci/micromamba/init.sh @@ -69,9 +69,13 @@ if [[ "$VERBOSE" -ge 2 ]]; then micromamba info fi +# Clean up previous environment +info "Cleaning up previous environment [$ENV_NAME]..." +chmod -R +w $THIS_DIR/micromamba/envs/dev +rm -rf $THIS_DIR/micromamba/envs/dev +micromamba deactivate # Create environment info "Creating environment [$ENV_NAME]..." -micromamba deactivate micromamba create --file $THIS_DIR/$ENV_NAME.yaml --name $ENV_NAME --yes $MAMBA_VERBOSITY # micromamba config set env_prompt "[{name}] " micromamba activate $ENV_NAME diff --git a/run_tests.sh b/run_tests.sh index 58e80c54..2a1170ea 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,8 +1,4 @@ #!/usr/bin/env bash -echo "Clean up previous micromamba environment" -chmod -R +w .ci/micromamba/micromamba/envs/dev -rm -rf .ci/micromamba/micromamba/envs/dev - echo "Initialize micromamba environment..." source ./.ci/micromamba/init.sh From 18312f13f71fdaf169881ed05aa60dd438834999 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 2 Jun 2026 14:39:42 +0200 Subject: [PATCH 5/8] Fix micromamba environment errors --- .ci/micromamba/init.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/micromamba/init.sh b/.ci/micromamba/init.sh index 2c280ab5..90048afa 100644 --- a/.ci/micromamba/init.sh +++ b/.ci/micromamba/init.sh @@ -69,10 +69,10 @@ if [[ "$VERBOSE" -ge 2 ]]; then micromamba info fi -# Clean up previous environment -info "Cleaning up previous environment [$ENV_NAME]..." -chmod -R +w $THIS_DIR/micromamba/envs/dev -rm -rf $THIS_DIR/micromamba/envs/dev +# Make previous environment modifiable to avoid bazel cache related micromamba errors +info "Changing permissions for previous environment [$ENV_NAME]..." +chmod -R +w $THIS_DIR/micromamba/envs/$ENV_NAME + micromamba deactivate # Create environment info "Creating environment [$ENV_NAME]..." From 7cb5f475ed70ae272b11fe57d20ca64f04ca8a6f Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 2 Jun 2026 14:39:53 +0200 Subject: [PATCH 6/8] Move test script to .ci/micromamba --- run_tests.sh => .ci/micromamba/run_tests.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) rename run_tests.sh => .ci/micromamba/run_tests.sh (66%) diff --git a/run_tests.sh b/.ci/micromamba/run_tests.sh similarity index 66% rename from run_tests.sh rename to .ci/micromamba/run_tests.sh index 2a1170ea..8ec32a39 100755 --- a/run_tests.sh +++ b/.ci/micromamba/run_tests.sh @@ -1,6 +1,12 @@ #!/usr/bin/env bash +SCRIPT_DIR=$(dirname "$(realpath "$0")") +cd $SCRIPT_DIR + echo "Initialize micromamba environment..." -source ./.ci/micromamba/init.sh +source ./init.sh + +# Change directory to project root +cd ../../ echo "Running pylint..." pylint . From 00facb128142b0f34fb7919ce9244cf0cb503c24 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Jun 2026 14:18:12 +0200 Subject: [PATCH 7/8] Add micromamba into CONTRIBUTING.md --- CONTRIBUTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46a32d7b..a17b810b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,13 +49,16 @@ test/test.sh | Functional and unit test runner Submitting a patch and testing ------- -Before submitting any changes please make sure all tests and checks are passed. +Before submitting any changes please make sure all tests and checks have passed inside the micromamba environment. +To enable the Micromamba testing environment run `source .ci/micromamba/init.sh`. +For more information see `.ci/micromamba/README.md`. You must run the following tests locally: * `pylint .` * `bazel test //...` * `pytest test` +To run all these test inside the micromamba environment automatically, run `.ci/micromamba/run_tests.sh`. On how to run or add a new test, please see [test/README.md](test/README.md). From 62eb8b9ff54eb98f859b474a0d9e613bda3aa1cb Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Thu, 4 Jun 2026 14:31:05 +0200 Subject: [PATCH 8/8] Update .ci/micromamba/init.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kristóf Umann --- .ci/micromamba/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/micromamba/init.sh b/.ci/micromamba/init.sh index 90048afa..a225fb8d 100644 --- a/.ci/micromamba/init.sh +++ b/.ci/micromamba/init.sh @@ -69,7 +69,7 @@ if [[ "$VERBOSE" -ge 2 ]]; then micromamba info fi -# Make previous environment modifiable to avoid bazel cache related micromamba errors +# Make the leftover environment modifiable to allow micromamba to delete bazel cache folders during its setup info "Changing permissions for previous environment [$ENV_NAME]..." chmod -R +w $THIS_DIR/micromamba/envs/$ENV_NAME