# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-pytest-httpbin
pkgver=2.1.0
pkgrel=0
pkgdesc="Easily test your HTTP library against a local copy of httpbin"
url="https://github.com/kevin1024/pytest-httpbin"
arch="noarch"
license="MIT"
depends="py3-httpbin"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-requests"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pytest-httpbin/pytest_httpbin-${pkgver/_/}.tar.gz"
builddir="$srcdir/pytest_httpbin-${pkgver/_/}"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# https://github.com/kevin1024/pytest-httpbin/issues/64
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not test_redirect_location_is_https_for_secure_server'
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
3c51d364f7c2db205636e54213ecdaa9657f802558050c38515bd91fc33546d31123172af2a25ff5f3c4717e43f0a090749b1aff3d80d74742bf5bf97f4eca0f  pytest_httpbin-2.1.0.tar.gz
"
