Skip to content

Commit

Permalink
Enforce test coverage (#91)
Browse files Browse the repository at this point in the history
Bring scripts to par with httpx
  • Loading branch information
Yeray Diaz Diaz authored May 20, 2020
1 parent 30847a0 commit 7cfb2d5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
11 changes: 11 additions & 0 deletions scripts/coverage
Original file line number Diff line number Diff line change
@@ -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
20 changes: 17 additions & 3 deletions scripts/test
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7cfb2d5

Please sign in to comment.