From: Tom Christie Date: Fri, 15 May 2020 15:17:33 +0000 (+0100) Subject: Enforce coverage (#955) X-Git-Tag: 0.13.0~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a8b0c65bd1576d2d3ad3ade1031c0e03917904d;p=thirdparty%2Fhttpx.git Enforce coverage (#955) * Enforce coverage when running tests * Enforce test coverage --- diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index d7b10500..5ba2dadf 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -29,3 +29,5 @@ jobs: run: "scripts/build" - name: "Run tests" run: "scripts/test" + - name: "Enforce coverage" + run: "scripts/coverage" diff --git a/scripts/coverage b/scripts/coverage new file mode 100755 index 00000000..68654daf --- /dev/null +++ b/scripts/coverage @@ -0,0 +1,11 @@ +#!/bin/sh -e + +export PREFIX="" +if [ -d 'venv' ] ; then + export PREFIX="venv/bin/" +fi +export SOURCE_FILES="httpx tests" + +set -x + +${PREFIX}coverage report --show-missing --skip-covered --fail-under=97 diff --git a/scripts/test b/scripts/test index 0ad0157a..7b35d2af 100755 --- a/scripts/test +++ b/scripts/test @@ -22,3 +22,7 @@ fi set -ex ${PREFIX}pytest $@ + +if [ -z $GITHUB_ACTIONS ]; then + scripts/coverage +fi diff --git a/setup.cfg b/setup.cfg index e61f81f2..61e27214 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,6 +16,6 @@ line_length = 88 multi_line_output = 3 [tool:pytest] -addopts = --cov=httpx --cov=tests --cov-report=term-missing -rxXs +addopts = --cov=httpx --cov=tests -rxXs markers = copied_from(source, changes=None): mark test as copied from somewhere else, along with a description of changes made to accodomate e.g. our test setup