# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Blair Bonnett <blair.bonnett@gmail.com>

pkgname=python-pytest-subprocess
pkgver=1.5.3
pkgrel=2
pkgdesc='Pytest plugin to fake subprocess'
arch=('any')
url='https://github.com/aklajnert/pytest-subprocess'
license=('MIT')
depends=(
  'python'
  'python-pytest'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=(
  'python-anyio'
  'python-docutils'
  'python-pygments'
  'python-pytest-asyncio'
  'python-pytest-rerunfailures'
)
source=("git+$url.git#tag=$pkgver")
sha256sums=('20369ba261a1075824ef57cc5a80e9f2be55cfc2836ce1a45648a085b003aba7')

build() {
  cd "${pkgname#python-}"
  python -m build --wheel --no-isolation
}

check() {
  cd "${pkgname#python-}"
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest
}

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