# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-pytest-randomly
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=pytest-randomly
pkgver=3.16.0
pkgrel=0
pkgdesc="Pytest plugin to randomly order tests and control random.seed."
url="https://github.com/pytest-dev/pytest-randomly"
arch="noarch"
license="MIT"
depends="py3-pytest"
checkdepends="
	py3-pytest-xdist
	py3-numpy
	py3-importlib-metadata
	py3-faker
	py3-factory-boy
	py3-coverage
	py3-model-bakery
	"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pytest-dev/pytest-randomly/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$pkgver"

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 "$builddir"/.dist/*.whl
	# FAILED tests/test_pytest_randomly.py::test_files_reordered - AssertionError: assert ['collecting ...st_it PASSED'] == ['test_b.py::...st_it PASSED']
	# FAILED tests/test_pytest_randomly.py::test_entrypoint_injection - AssertionError: assert [] == [call(1), cal...l(1), call(2)]
	# FAILED tests/test_pytest_randomly.py::test_files_reordered_when_seed_not_reset - AssertionError: assert ['collecting ...st_it PASSED'] == ['test_b.py::...st_it PASSED']
	# FAILED tests/test_pytest_randomly.py::test_test_functions_reordered - AssertionError: assert ['collecting ...est_a PASSED'] == ['test_one.py...est_d PASSED']
	# FAILED tests/test_pytest_randomly.py::test_test_functions_reordered_when_randomness_in_module - AssertionError: assert ['collecting ...est_a PASSED'] == ['test_one.py...est_d PASSED']
	# FAILED tests/test_pytest_randomly.py::test_doctests_reordered - AssertionError: assert ['collecting ... 2 items', ''] == ['test_one.py...e.foo PASSED']
	# FAILED tests/test_pytest_randomly.py::test_classes_reordered - AssertionError: assert ['collecting ...est_b PASSED'] == ['test_one.py...est_a PASSED']
	# FAILED tests/test_pytest_randomly.py::test_class_test_methods_reordered - AssertionError: assert ['collecting ...est_b PASSED'] == ['test_one.py...est_d PASSED']
	# FAILED tests/test_pytest_randomly.py::test_doctests_in_txt_files_reordered - AssertionError: assert ['collecting ... 2 items', ''] == ['test2.txt::...t.txt PASSED']
	.testenv/bin/python3 -m pytest -v -k 'not test_files_reordered and not test_entrypoint_injection and not test_functions_reordered and not test_doctests_reordered and not test_classes_reordered and not test_classes_reordered and not test_class_test_methods_reordered and not test_doctests_in_txt_files_reordered'
}

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

sha512sums="
310605c6acaa4a9e1aa6689594d047c7edb1ef8597091d6eac884ca5920c2e29eb02cafdaaf5202d2c0b1c5ac7ad13988230597267336a0347be0bd60a8b67f0  py3-pytest-randomly-3.16.0.tar.gz
"
