]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Enforce coverage (#955)
authorTom Christie <tom@tomchristie.com>
Fri, 15 May 2020 15:17:33 +0000 (16:17 +0100)
committerGitHub <noreply@github.com>
Fri, 15 May 2020 15:17:33 +0000 (16:17 +0100)
* Enforce coverage when running tests

* Enforce test coverage

.github/workflows/test-suite.yml
scripts/coverage [new file with mode: 0755]
scripts/test
setup.cfg

index d7b1050088b094ee986a2f8f100ed4cdcaf24b35..5ba2dadf343c9c0d0ca01f7bf3af88f6888cf0e3 100644 (file)
@@ -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 (executable)
index 0000000..68654da
--- /dev/null
@@ -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
index 0ad0157ac2c55f59c215a9568e49928a7510de22..7b35d2af645f4ccf2dc0929f0b658a824df5c1f5 100755 (executable)
@@ -22,3 +22,7 @@ fi
 set -ex
 
 ${PREFIX}pytest $@
+
+if [ -z $GITHUB_ACTIONS ]; then
+    scripts/coverage
+fi
index e61f81f2a11541505f916072f2115a62cbd9aaa4..61e27214d86271809aed225d08f707503af211ec 100644 (file)
--- 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