mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-30 23:51:00 +00:00
# What does this PR do? <!-- Provide a short summary of what this PR does and why. Link to relevant issues if applicable. --> - Added `set -e` to the beginning of the unit test script to ensure the script exits on failure and correctly fails the CI when tests do not pass. - Fixed all unit tests that were silently failing in the CI. - Fixed Python 3.13 unit test CI failing silently. <!-- If resolving an issue, uncomment and update the line below --> <!-- Closes #[issue-number] --> Closes #2877 ## Test Plan <!-- Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.* --> - **Previously:** Unit tests passing in CI eventhough it failed 11 tests -> [CI-run](4683681501 (step)
:4:2097) - **Made the fix. Now, ensuring CI fails as expected on test failures:** Unit tests failing in CI with 1 failed test -> [CI-run](4684234247 (step)
:4:1506) - This PR shows the CI passing and all unit tests passing.
30 lines
869 B
Bash
Executable file
30 lines
869 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the terms described in the LICENSE file in
|
|
# the root directory of this source tree.
|
|
|
|
PYTHON_VERSION=${PYTHON_VERSION:-3.12}
|
|
|
|
set -e
|
|
|
|
# Always run this at the end, even if something fails
|
|
cleanup() {
|
|
echo "Generating coverage report..."
|
|
uv run --python "$PYTHON_VERSION" coverage html -d htmlcov-$PYTHON_VERSION
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
command -v uv >/dev/null 2>&1 || { echo >&2 "uv is required but it's not installed. Exiting."; exit 1; }
|
|
|
|
uv python find "$PYTHON_VERSION"
|
|
FOUND_PYTHON=$?
|
|
if [ $FOUND_PYTHON -ne 0 ]; then
|
|
uv python install "$PYTHON_VERSION"
|
|
fi
|
|
|
|
# Run unit tests with coverage
|
|
uv run --python "$PYTHON_VERSION" --with-editable . --group unit \
|
|
coverage run --source=llama_stack -m pytest -s -v tests/unit/ "$@"
|