# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-chai
pkgver=1.1.2
pkgrel=2
pkgdesc="Easy to use mocking, stubbing and spying framework"
url="https://github.com/agoragames/chai"
arch="noarch"
license="BSD-3-Clause"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/agoragames/chai/archive/refs/tags/${pkgver//./_}.tar.gz"
builddir="$srcdir/chai-${pkgver//./_}"

prepare() {
	default_prepare
	# too many instances to produce a small diff
	sed -i 's/self.assertEquals/self.assertEqual/' tests/*.py
	sed -i 's/self.assertNotEquals/self.assertNotEqual/' tests/*.py
	sed -i 's/assert_equals/assert_equal/' tests/*.py
}

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

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

sha512sums="
ea6ce1bd1e40beae8cac31953a56bb1cc7f260ba27bc823ea27d6530749b1ae525bdf823229f641b4b90ab718a1dd8e8087915125c700ae479968a60e3984da6  py3-chai-1.1.2.tar.gz
"
