From ced56130b049a27ea527042a2210d2d5a8e8b4dd Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Wed, 8 Apr 2026 12:02:45 +0200 Subject: [PATCH 1/4] 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/4] 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/4] 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/4] 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