# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Sebastien LEDUC <sebastien@sleduc.fr>
# Contributor: Andrey Mikhaylenko <neithere at gmail dot com>

pkgname=python-pytest-cov
pkgver=7.1.0
pkgrel=1
pkgdesc='py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing'
arch=('any')
license=('MIT')
url='https://github.com/pytest-dev/pytest-cov'
depends=('python-coverage' 'python-pluggy' 'python-pytest')
makedepends=('git' 'python-build' 'python-hatch-fancy-pypi-readme' 'python-hatchling' 'python-installer')
checkdepends=('python-virtualenv' 'python-process-tests' 'python-pytest-xdist')
source=("git+https://github.com/pytest-dev/pytest-cov.git#tag=v$pkgver")
sha512sums=('65b81ea16bdfd938513fb5f13b0312ea321c3a5bd89fce571be25cc7319df275aab143254c98a322d1440986dd462939307d6ebaac6740de2fefd0b9400173da')

build() {
  cd pytest-cov
  python -m build --wheel --no-isolation
}

check() {
  cd pytest-cov
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  # Arch does not package python-celery for test_celery.
  PYTHONPATH="$PWD/tests" test-env/bin/python -m pytest --deselect tests/test_pytest_cov.py::test_celery
}

package() {
  cd pytest-cov
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

# vim:set ts=2 sw=2 et:
