diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..518b4e0 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,18 @@ +comment: + layout: "diff, files" + behavior: default + branches: null + + +coverage: + range: 50..100 + round: down + precision: 2 + + status: + project: + default: + target: '70' + patch: + default: + target: '70' diff --git a/.travis.yml b/.travis.yml index dac107c..4d86380 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,11 +76,15 @@ before_install: - chmod +x .travis/build_windows_wheels.sh - chmod +x .travis/deploy.sh - chmod +x .travis/prepare_windows_build.sh + - chmod +x .travis/upload_coverage.sh install: - .travis/prepare_windows_build.sh - source .travis/install.sh +after_success: + - .travis/upload_coverage.sh + script: - tox diff --git a/.travis/install.sh b/.travis/install.sh index 93507d1..25abf57 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -85,6 +85,6 @@ if [[ $TRAVIS_OS_NAME == "osx" ]]; then fi # Install necessary packages -python -m pip install -U cffi tox +python -m pip install -U cffi tox codecov set +x +e diff --git a/.travis/upload_coverage.sh b/.travis/upload_coverage.sh new file mode 100644 index 0000000..cfd1d1d --- /dev/null +++ b/.travis/upload_coverage.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e +set -x + +if [ -n "${TOXENV}" ]; then + case "${TOXENV}" in + style);; + ^bench$);; + *) + codecov -X gcov + ;; + esac +fi diff --git a/README.rst b/README.rst index e3e434f..da67331 100644 --- a/README.rst +++ b/README.rst @@ -7,6 +7,9 @@ Coincurve .. image:: https://img.shields.io/travis/ofek/coincurve/master.svg?style=flat-square :target: https://travis-ci.org/ofek/coincurve +.. image:: https://codecov.io/github/ofek/coincurve/coverage.svg?branch=master + :target: https://codecov.io/github/ofek/coincurve?branch=master + .. image:: https://img.shields.io/pypi/pyversions/coincurve.svg?style=flat-square :target: https://pypi.org/project/coincurve diff --git a/coincurve/ecdsa.py b/coincurve/ecdsa.py index fe15356..1a18a6c 100644 --- a/coincurve/ecdsa.py +++ b/coincurve/ecdsa.py @@ -70,7 +70,7 @@ Warning: """ -def serialize_compact(raw_sig, context=GLOBAL_CONTEXT): +def serialize_compact(raw_sig, context=GLOBAL_CONTEXT): # no cov output = ffi.new('unsigned char[%d]' % CDATA_SIG_LENGTH) res = lib.secp256k1_ecdsa_signature_serialize_compact(context.ctx, output, raw_sig) @@ -79,7 +79,7 @@ def serialize_compact(raw_sig, context=GLOBAL_CONTEXT): return bytes(ffi.buffer(output, CDATA_SIG_LENGTH)) -def deserialize_compact(ser_sig, context=GLOBAL_CONTEXT): +def deserialize_compact(ser_sig, context=GLOBAL_CONTEXT): # no cov if len(ser_sig) != 64: raise Exception("invalid signature length") @@ -90,7 +90,7 @@ def deserialize_compact(ser_sig, context=GLOBAL_CONTEXT): return raw_sig -def signature_normalize(raw_sig, context=GLOBAL_CONTEXT): +def signature_normalize(raw_sig, context=GLOBAL_CONTEXT): # no cov """ Check and optionally convert a signature to a normalized lower-S form. If check_only is True then the normalized signature is not returned. @@ -107,7 +107,7 @@ def signature_normalize(raw_sig, context=GLOBAL_CONTEXT): return not not res, sigout -def recoverable_convert(recover_sig, context=GLOBAL_CONTEXT): +def recoverable_convert(recover_sig, context=GLOBAL_CONTEXT): # no cov normal_sig = ffi.new('secp256k1_ecdsa_signature *') lib.secp256k1_ecdsa_recoverable_signature_convert(context.ctx, normal_sig, recover_sig) diff --git a/coincurve/keys.py b/coincurve/keys.py index e8e2cd0..ca5e254 100644 --- a/coincurve/keys.py +++ b/coincurve/keys.py @@ -169,7 +169,7 @@ class PublicKey: parsed = lib.secp256k1_ec_pubkey_parse(context.ctx, public_key, data, len(data)) if not parsed: - raise ValueError('The public key could not be parsed or is ' 'invalid.') + raise ValueError('The public key could not be parsed or is invalid.') self.public_key = public_key @@ -181,7 +181,7 @@ class PublicKey: created = lib.secp256k1_ec_pubkey_create(context.ctx, public_key, validate_secret(secret)) - if not created: + if not created: # no cov raise ValueError( 'Somehow an invalid secret was used. Please ' 'submit this as an issue here: '