Skip to main content

scripts/run_chives_tests.sh

1#!/usr/bin/env bash
3set -o errexit
4set -o nounset
6# Print a command in blue, then run the command
7run_command() {
8 echo ""
9 echo -e "\033[34m-> $@\033[0m"
10 bash -c "$@"
13report_coverage() {
14 echo ""
15 echo -e "\033[34m-> python3 -m coverage report\033[0m"
16 if [[ $(python3 -m coverage report --format=total) = "100" ]]
17 then
18 echo "100% coverage!"
19 else
20 python3 -m coverage
21 fi
24run_command 'ruff format'
26if [[ "${CI:-}" == "true" ]]
27then
28 run_command 'git diff --exit-code'
29fi
31run_command 'ruff check'
32run_command 'mypy src tests'
33run_command "python3 -m coverage run -m pytest -q tests"
34report_coverage