# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-pyfakefs
_pkgname=${pkgname#py3-}
pkgver=5.6.0
pkgrel=0
pkgdesc="fake file system that mocks the Python file system modules"
url="https://github.com/pytest-dev/pyfakefs/"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

case "$CARCH" in
# fails on builder currently
aarch64|armhf|armv7|riscv64) _test_filter='not test_chown_follow_symlink and not test_chown_no_follow_symlink' ;;
esac

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

	# pytest_fixture_test.py: needs currently unpackaged 'undefined' module
	.testenv/bin/python3 -m pytest \
		--ignore pyfakefs/pytest_tests/pytest_fixture_test.py \
		-k "$_test_filter"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -r "$pkgdir"/usr/lib/python*/site-packages/pyfakefs/*tests
}

sha512sums="
7113c6b04a6c3a9d606d07cfcb9c3847617310d5b6a460361b539efe1d5c911da9050c0c24930f3b43ffdc46d30ce723245f63b933bd179c2abe669837ab3fa9  pyfakefs-5.6.0.tar.gz
"
