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

pkgname=python-jaraco.test
pkgver=5.4.0
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' 'python-pytest-enabler' 'python-pytest-mypy' 'python-pytest-ruff')
source=("git+https://github.com/jaraco/jaraco.test.git#tag=v$pkgver")
sha512sums=('37c97e885710e98a746ca300989d0b74da096e22abc9ba1122a31c0f14d5e6ae129cb65feb66c8d58561416371df7d5e62e1bb38dc406abac65b0ff6f91ff390')

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::test.cpython
    --deselect jaraco/test/cpython.py::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/
}
