# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pytest-django
pkgver=4.11.1
pkgrel=0
pkgdesc="Django plugin for pytest"
url="https://pytest-django.readthedocs.io/"
arch="noarch"
license="BSD-3-Clause"
depends="py3-pytest"
makedepends="py3-setuptools py3-setuptools_scm py3-wheel py3-gpep517"
checkdepends="py3-pytest py3-pytest-xdist py3-django"
subpackages="$pkgname-pyc"
source="https://github.com/pytest-dev/pytest-django/archive/refs/tags/v$pkgver/py3-pytest-django-$pkgver.tar.gz"
builddir="$srcdir/pytest-django-$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
	# needs pytest_django_test from project root
	PYTHONPATH="$PWD" \
	DJANGO_SETTINGS_MODULE=pytest_django_test.settings_sqlite_file \
		.testenv/bin/python3 -m pytest
}

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

sha512sums="
2c6732277e339c0731214af7dfd06618c29393a9b06fe009beac15ac9aba568763f1595315eaa3416cbaa292a9e44ee1d608d265c148d95e1c8679f5b534f064  py3-pytest-django-4.11.1.tar.gz
"
