Skip to content

Commit

Permalink
test.sh: improve test selection message
Browse files Browse the repository at this point in the history
Improve how tests selection is announced by the test script.

Previously:
$ tools/test.sh -m summ_ai_sanity -vv tests/summ_ai_sanity/
[...]
Running all tests in with summ_ai_sanity, tests/summ_ai_sanity/...

Now:
$ tools/test.sh -m summ_ai_sanity -vv tests/summ_ai_sanity/
[...]
Running all tests with summ_ai_sanity in "tests/summ_ai_sanity/"...
  • Loading branch information
PeterNerlich committed Feb 5, 2025
1 parent 6e6e179 commit 7f1c323
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tools/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,16 @@ if [[ -z "${CHANGED}" ]] && (( ${#TESTS[@]} == 0 )); then
fi

if [[ -n "${KW_EXPR}" ]] || [[ -n "${MARKER}" ]] || (( ${#TESTS[@]} )); then
MESSAGES=()
TEST_MESSAGE=""
if [[ -n "${KW_EXPR}" ]]; then
MESSAGES+=("\"${KW_EXPR}\"")
TEST_MESSAGE+=" \"${KW_EXPR}\""
PYTEST_ARGS+=("-k" "${KW_EXPR}")
fi
if [[ -n "${MARKER}" ]]; then
MESSAGES+=("with ${MARKER}")
TEST_MESSAGE+=" with ${MARKER}"
PYTEST_ARGS+=("-m" "${MARKER}")
fi
MESSAGES=()
# Check whether test paths exist
for t in "${TESTS[@]}"; do
if [[ -e "${t%%::*}" ]]; then
Expand All @@ -109,8 +110,8 @@ if [[ -n "${KW_EXPR}" ]] || [[ -n "${MARKER}" ]] || (( ${#TESTS[@]} )); then
exit 1
fi
done
TEST_MESSAGE=$(join_by ", " "${MESSAGES[@]}")
TEST_MESSAGE=" in ${TEST_MESSAGE}"
MESSAGES=$(join_by ", " "${MESSAGES[@]}")
TEST_MESSAGE+=" in ${MESSAGES}"
fi

"$(dirname "${BASH_SOURCE[0]}")/prune_pdf_cache.sh"
Expand Down

0 comments on commit 7f1c323

Please sign in to comment.