You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
855 B

#!/bin/bash
# Get current script path
SCRIPT_PATH="$(dirname -- "$(readlink -f -- "${0}")")"
# Activate OctoDNS Python venv
source "${SCRIPT_PATH}/common.sh"
SOURCE_DIR="octodns/"
# Don't allow disabling coverage
PRAGMA_OUTPUT=$(grep -r -I --line-number "# pragma: \+no.*cover" "$SOURCE_DIR" || echo)
PRAGMA_COUNT=$(echo "$PRAGMA_OUTPUT" | grep -c . || true)
PRAGMA_ALLOWED=5
if [ "$PRAGMA_COUNT" -ne "$PRAGMA_ALLOWED" ]; then
echo "Found $PRAGMA_COUNT instances of 'pragma: no cover' (no more than $PRAGMA_ALLOWED allowed):"
echo "$PRAGMA_OUTPUT"
echo "Code coverage should not be disabled, except for version handling blocks"
exit 1
fi
pytest \
--disable-network \
--cov-reset \
--cov=$SOURCE_DIR \
--cov-fail-under=100 \
--cov-report=html \
--cov-report=json \
--cov-report=xml \
--cov-report=term \
--cov-branch \
"$@"