From e274d27be501cee97cd3a91567d7f6d8ab53ef54 Mon Sep 17 00:00:00 2001 From: Deborah Brouwer Date: Wed, 11 Dec 2024 14:19:28 -0800 Subject: [PATCH] ci: run-pytest.sh: allow script to run locally Currently, run-pytest.sh won't run locally outside of a pipeline because it can't find the `setup-test-env.sh` which provides necessary functions. Add a default value for the SCRIPTS_DIR so that run-pytest can find and run the setup-test-env.sh and be run locally outside of a pipeline. Part-of: --- .gitlab-ci/run-pytest.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/run-pytest.sh b/.gitlab-ci/run-pytest.sh index 1034d198f11..2225be59fec 100755 --- a/.gitlab-ci/run-pytest.sh +++ b/.gitlab-ci/run-pytest.sh @@ -7,16 +7,29 @@ # shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime. # shellcheck disable=SC2086 # quoting PYTEST_VERBOSE makes us pass an empty path -. "${SCRIPTS_DIR}/setup-test-env.sh" +set -eu + +if [ -z "${SCRIPTS_DIR:-}" ]; then + SCRIPTS_DIR="$(dirname "${0}")" +fi + +if [ -z "${CI_JOB_STARTED_AT:-}" ]; then + CI_JOB_STARTED_AT=$(date -u +%Y-%m-%dT%H:%M:%SZ) # isoformat +fi + +source "${SCRIPTS_DIR}/setup-test-env.sh" section_start pytest_setup "Setting up pytest environment" -set -exu - if [ -z "${CI_PROJECT_DIR:-}" ]; then CI_PROJECT_DIR="$(dirname "${0}")/../" fi +if [ -z "${CI_JOB_TIMEOUT:-}" ]; then + # Export this default value, 1 hour in seconds, to test the lava job submitter + export CI_JOB_TIMEOUT=3600 +fi + if [ -z "${MESA_PYTEST_VENV:-}" ]; then MESA_PYTEST_VENV="${CI_PROJECT_DIR}/.venv-pytest" fi