From 2d9a5008ba51f079f6c2505af56ba199cdd96137 Mon Sep 17 00:00:00 2001 From: Feng Shengqin Date: Fri, 21 Oct 2016 04:26:33 +0800 Subject: [PATCH] fix cover.sh to allow db version changes without ut When db version changes, a new file will be added. But there is no unit tests for the file, such as "1afee1db6cd0_add_master_flavor.py". Then the command "tox -e cover" will fail. The change to fix it. Change-Id: I16b2f489001707ede067251549a0a78935e49cbb --- cover.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cover.sh b/cover.sh index 153179e5c0..a03570fb2d 100755 --- a/cover.sh +++ b/cover.sh @@ -29,6 +29,7 @@ fi # Checkout master and save coverage report git checkout HEAD^ +base_op_count=`grep "op\." -R magnum/db/sqlalchemy/alembic/versions/ | wc -l` baseline_report=$(mktemp -t magnum_coverageXXXXXXX) find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*" coverage report > $baseline_report @@ -39,13 +40,14 @@ baseline_missing=$(awk 'END { print $3 }' $baseline_report) # Checkout back and save coverage report git checkout - +current_op_count=`grep "op\." -R magnum/db/sqlalchemy/alembic/versions/ | wc -l` current_report=$(mktemp -t magnum_coverageXXXXXXX) find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*" coverage report > $current_report current_missing=$(awk 'END { print $3 }' $current_report) # Show coverage details -allowed_missing=$((baseline_missing+ALLOWED_EXTRA_MISSING)) +allowed_missing=$((baseline_missing+ALLOWED_EXTRA_MISSING+current_op_count-base_op_count)) echo "Allowed to introduce missing lines : ${ALLOWED_EXTRA_MISSING}" echo "Missing lines in master : ${baseline_missing}"