# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-codecov
pkgver=2.1.13
pkgrel=2
pkgdesc="Report uploader for Codecov"
url="https://github.com/codecov/codecov-python"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-coverage py3-requests"
makedepends="py3-gpep517 py3-wheel py3-setuptools"
checkdepends="py3-pytest py3-ddt py3-mock"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/codecov/codecov-python/archive/v$pkgver.tar.gz"
builddir="$srcdir"/codecov-python-$pkgver

replaces="py-codecov" # Backwards compatibility
provides="py-codecov=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
			--wheel-dir .dist \
			--output-fd 3 3>&1 >&2
}

check() {
	# Disable tests that require git history (the last one fails only on gitlab CI).
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest tests/test.py -k 'not test_bowerrc_none and not test_prefix and not test_send and not test_ci_gitlab_pre9'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
beddc2d19c6d2b535340e10084fc197ba4a86878d0c1c3da50d93ee4e7ed90cfa1f5456e1e8b6d1bee781c653b296e291b2257761f9b0339408a9f3d7844646e  py3-codecov-2.1.13.tar.gz
"
