# Contributor: Antoine Fontaine <antoine.fontaine@epfl.ch>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pytest-aiohttp
pkgver=1.1.0
pkgrel=0
pkgdesc="pytest plugin for aiohttp support"
url="https://github.com/aio-libs/pytest-aiohttp/"
arch="noarch"
license="Apache-2.0"
depends="py3-aiohttp py3-pytest-asyncio"
makedepends="py3-setuptools py3-setuptools_scm py3-wheel py3-gpep517"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/aio-libs/pytest-aiohttp/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/pytest-aiohttp-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
7f4362c9ef2ef4b63c5f9ef246f59bef78f4962df9878e81bfd4f70f5dccd1eaae1b08cf1389bcdf6d8b9efc2363415b16bcf071aac5e6a640940da12ffb35c3  py3-pytest-aiohttp-1.1.0.tar.gz
"
