# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pytest-django
pkgver=4.8.0
pkgrel=1
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="
8f7ba6b28cc4c0347876beb85247ccd021767811b9122c8cd0fb5d051df4ae76267b27a3fee5c36882a40716bdcbaab43abf71ef8dd61757087b12fd141632aa  py3-pytest-django-4.8.0.tar.gz
"
