From 3a8fcb2d5a5296e289562be40c826037e3e39c03 Mon Sep 17 00:00:00 2001 From: Daniil Fajnberg Date: Wed, 6 Apr 2022 21:47:39 +0200 Subject: [PATCH] Optimize coverage script/settings --- .coveragerc | 6 ++---- coverage.sh | 13 +++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.coveragerc b/.coveragerc index f70c551..2a8279e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,8 +1,7 @@ [run] source = src/ branch = true -omit = - .venv/* +command_line = -m unittest discover [report] fail_under = 100 @@ -11,5 +10,4 @@ skip_covered = False exclude_lines = if TYPE_CHECKING: if __name__ == ['"]__main__['"]: -omit = - tests/* + if sys.version_info.+: diff --git a/coverage.sh b/coverage.sh index c0e4597..67c77ed 100755 --- a/coverage.sh +++ b/coverage.sh @@ -12,13 +12,14 @@ # You should have received a copy of the GNU Lesser General Public License along with asyncio-taskpool. # If not, see . -coverage erase && coverage run -m unittest discover 2> /dev/null +coverage erase +coverage run 2> /dev/null -typeset total -total=$(coverage report | awk '$1 == "TOTAL" {print $NF}') +typeset report=$(coverage report) +typeset total=$(echo "${report}" | awk '$1 == "TOTAL" {print $NF; exit}') -if [[ $total == 100% ]]; then - echo $total +if [[ ${total} == 100% ]]; then + echo ${total} else - coverage report + echo "${report}" fi