3232# Sourcing required to update callers environment.
3333source ./kokoro/testutils/install_protoc.sh " 30.2"
3434
35+ # Make sure we use the latest supported Python version.
36+ eval " $( pyenv init -) "
37+ pyenv install -s 3.13
38+ pyenv shell 3.13
39+
3540./kokoro/testutils/install_tink_via_pip.sh " $( pwd) "
3641
3742CACHE_FLAGS=()
@@ -45,20 +50,25 @@ readonly CACHE_FLAGS
4550# testing/helper.py will look for testdata in TINK_PYTHON_ROOT_PATH/testdata.
4651export TINK_PYTHON_ROOT_PATH=" $( pwd) "
4752
48- ./kokoro/testutils/copy_credentials.sh " testdata" " all"
49- ./kokoro/testutils/copy_credentials.sh " examples/testdata" " gcp"
50-
5153echo " ---------- RUNNING TEST WITH PYTHON ($( date) )"
5254find tink/ -not -path " *integration/*" -type f -name " *_test.py" -print0 \
5355 | xargs -t -0 -n1 python3
5456
5557cd examples
5658
57- echo " --------- tests_pip_install_tink tests"
58- TARGETS=$( bazel query ' attr(tags, tests_pip_install_tink, ...) except attr(tags, requires_kms, ...)' )
59+ # We are running bash scripts that use the local python3 toolchain to run tests
60+ # against the locally installed tink-py. These are `sh_test` targets and we
61+ # run them with `bazelisk test` because it is more convenient.
62+
63+ # Intall test requirements for the local python3 toolchain.
64+ python3 -m pip install --require-hashes --no-deps -r requirements.txt
65+
66+ echo " --------- EXAMPLE TARGETS (tests_pip_install_tink, not requires_kms)"
67+ TARGETS=$( bazelisk query ' attr(tags, tests_pip_install_tink, ...) except attr(tags, requires_kms, ...)' )
5968echo " ${TARGETS} "
6069
61- echo " ---------- BUILDING KMS Specific tests ($( date) )"
70+ echo " ---------- BUILDING EXAMPLES ($( date) )"
6271bazelisk build " ${CACHE_FLAGS[@]} " -- $TARGETS
63- echo " ---------- TESTING KMS Specific tests ($( date) )"
64- bazelisk test " ${CACHE_FLAGS[@]} " -- $TARGETS
72+ echo " ---------- TESTING EXAMPLES ($( date) )"
73+ bazelisk test " ${CACHE_FLAGS[@]} " \
74+ --test_env=PYENV_VERSION=" ${PYENV_VERSION} " -- $TARGETS
0 commit comments