# Contributor: Duncan Bellamy <dunk@denkimushi.com>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=py3-pytest-httpbin
pkgver=2.0.0
pkgrel=1
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="
679a51e5155cf952258cab6efb3c26fd21b8a84a73b720dc5c00b36958c11a8de27b6ea6c696c76fe4e2a85fec56a2485d3233705301f11e45cb967328700657  pytest-httpbin-2.0.0.tar.gz
"
