# 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=6.1.1
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-pytest')
makedepends=('git' 'python-setuptools')
checkdepends=('python-virtualenv' 'python-process-tests' 'python-pytest-xdist' 'python-fields')
source=("git+https://github.com/pytest-dev/pytest-cov.git#tag=v$pkgver")
sha512sums=('d2d68807abbdaf039ebfae420a6b4d1c0f7c67e5e5076972352f51609e7888f231910221d1725af72529412f920be48cfcfae42a9abb65cb2cec0b56b528ce74')

build() {
  cd pytest-cov
  python setup.py build
}

check() {
  # Hack entry points by installing it

  cd pytest-cov
  python setup.py install --root="$PWD/tmp_install" --optimize=1
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH:$PWD/tests" pytest || echo "Tests failed"
}

package() {
  cd pytest-cov
  python setup.py install --root="$pkgdir" --optimize=1
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}

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