Browse Source

Use Codecov to track coverage (#41)

* Use Codecov to track coverage
anonswap
Ofek Lev 6 years ago
committed by GitHub
parent
commit
529b798d03
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      .codecov.yml
  2. 4
      .travis.yml
  3. 2
      .travis/install.sh
  4. 14
      .travis/upload_coverage.sh
  5. 3
      README.rst
  6. 8
      coincurve/ecdsa.py
  7. 4
      coincurve/keys.py

18
.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'

4
.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

2
.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

14
.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

3
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

8
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)

4
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: '

Loading…
Cancel
Save