# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-factory-boy
_pkgname=factory_boy
pkgver=3.3.1
pkgrel=0
pkgdesc="A versatile test fixtures replacement based on thoughtbot's factory_girl for Ruby"
url="https://github.com/FactoryBoy/factory_boy"
arch="noarch"
license=MIT
depends="python3 py3-faker"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="
	py3-mock py3-django py3-sqlalchemy-utils py3-pytest py3-flask-sqlalchemy
"
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/factory_boy/archive/$pkgver.tar.gz
	disable-mongoengine.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-factory-boy" # Backwards compatibility
provides="py-factory-boy=$pkgver-r$pkgrel" # Backwards compatibility

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
	DJANGO_SETTINGS_MODULE=tests.djapp.settings .testenv/bin/python3 -m pytest -v
}

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

sha512sums="
4d996530f3f38c7c19ca4815831ebe2f58b8c5b514ea328f96550f6f9286e02a4ac19621527f9efe7f50209800ed918db83af9423358f0e6225bd1a94c7f8abb  py3-factory-boy-3.3.1.tar.gz
1753fb11546c2f3f5216999e3e34ecf4aeec17c7d6e0a130fb4da1f5af69a0dce750ef33ce35a11eae08905067180e489ecec2d13c4d123ddf017f8296417ea1  disable-mongoengine.patch
"
