From 7cfb2d5847e86d9ce21ad90a3cb7d17ec5bf4f26 Mon Sep 17 00:00:00 2001 From: Yeray Diaz Diaz Date: Wed, 20 May 2020 13:08:40 +0100 Subject: [PATCH] Enforce test coverage (#91) Bring scripts to par with httpx --- scripts/coverage | 11 +++++++++++ scripts/test | 20 +++++++++++++++++--- setup.cfg | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100755 scripts/coverage diff --git a/scripts/coverage b/scripts/coverage new file mode 100755 index 00000000..0e9b71c3 --- /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=91 diff --git a/scripts/test b/scripts/test index 6a4a752f..7b35d2af 100755 --- a/scripts/test +++ b/scripts/test @@ -1,14 +1,28 @@ -#!/bin/sh -e +#!/bin/sh export PREFIX="" if [ -d 'venv' ] ; then export PREFIX="venv/bin/" fi -set -x - if [ -z $GITHUB_ACTIONS ]; then + set +e scripts/check + while [ $? -ne 0 ]; do + read -p "Running 'scripts/check' failed. Do you want to run 'scripts/lint' now? [y/N] " yn + case $yn in + [Yy]* ) :;; + * ) exit;; + esac + scripts/lint + scripts/check + done fi +set -ex + ${PREFIX}pytest $@ + +if [ -z $GITHUB_ACTIONS ]; then + scripts/coverage +fi diff --git a/setup.cfg b/setup.cfg index 5cff3486..f49112b6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,6 @@ line_length = 88 multi_line_output = 3 [tool:pytest] -addopts = --cov=httpcore --cov=tests --cov-report=term-missing -rxXs +addopts = --cov-report= --cov=httpcore --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