# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-jaraco.test
pkgver=5.5.1
pkgrel=1
pkgdesc="Testing support by jaraco"
url="https://github.com/jaraco/jaraco.test"
license=('MIT')
arch=('any')
depends=('python' 'python-jaraco.collections' 'python-jaraco.context' 'python-jaraco.functools')
makedepends=('git' 'python-setuptools-scm' 'python-wheel' 'python-build' 'python-installer')
checkdepends=('python-pytest')
source=("git+https://github.com/jaraco/jaraco.test.git#tag=v$pkgver")
sha512sums=('d432cde578b256e0c8b3cbd6430c36e8a235fe6375d784cdc762fe7d48466d65f904be781ef4e1303ada6edb9801e9af019ba11368604e62f84c05046b086265')

build() {
  cd jaraco.test
  python -m build --wheel --no-isolation
}

check() {
  local pytest_options=(
    -vv
    # ignore doctests to not pull in more dependencies
    --deselect jaraco/test/cpython.py::jaraco.test.cpython
    --deselect jaraco/test/cpython.py::jaraco.test.cpython.from_test_support
  )
  cd jaraco.test
  python -m pytest "${pytest_options[@]}"
}

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