# Template file for 'python3-pytest'
pkgname=python3-pytest
version=8.3.4
revision=1
build_style=python3-pep517
_common_deps="python3-iniconfig python3-pluggy"
hostmakedepends="python3-setuptools_scm python3-Sphinx ${_common_deps}"
depends="python3-packaging ${_common_deps}"
checkdepends="$depends"
short_desc="Simple powerful testing with Python 3"
maintainer="Piotr Wójcik <chocimier@tlen.pl>"
license="MIT"
homepage="https://docs.pytest.org/en/latest/"
changelog="https://docs.pytest.org/en/latest/changelog.html"
distfiles="${PYPI_SITE}/p/pytest/pytest-${version}.tar.gz"
checksum=965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761
alternatives="
 pytest:pytest:/usr/bin/pytest3
 pytest:py.test:/usr/bin/py.test3"

if [ "$XBPS_CHECK_PKGS" = full ]; then
	# optional test dependencies: only for -K to minimize check-time cycles
	checkdepends+=" lsof python3-Jinja2 python3-Pygments python3-Twisted
	 python3-argcomplete python3-attrs python3-decorator python3-hypothesis
	 python3-mock python3-numpy python3-pexpect python3-pytest-xdist
	 python3-requests python3-xmlschema"
	testjobs="-n $XBPS_MAKEJOBS"
else
	# deselect tests that need some of the optional test dependencies
	make_check_args+="
	 --ignore testing/python/metafunc.py
	 --ignore testing/test_assertion.py
	 --ignore testing/test_junitxml.py
	 --deselect testing/io/test_terminalwriter.py::test_code_highlight[with
	 --deselect testing/test_entry_points.py::test_pytest_entry_points_are_identical
	 --deselect testing/test_error_diffs.py::test_error_diff[Compare
	 --deselect testing/test_terminal.py::test_color_yes
	 --deselect testing/test_terminal.py::TestCodeHighlight::test_code_highlight_
	 "
fi

post_build() {
	PYTHONPATH="${PWD}/build/lib:${XBPS_CROSS_BASE}/${py3_lib}" make -C doc/en man
	vman doc/en/_build/man/pytest.1
}

do_check() {
	PYTHONPATH="${PWD}/build/lib" python3 -m pytest \
		${testjobs} ${make_check_args}
}

post_install() {
	mv ${DESTDIR}/usr/bin/pytest ${DESTDIR}/usr/bin/pytest3
	mv ${DESTDIR}/usr/bin/py.test ${DESTDIR}/usr/bin/py.test3
	vlicense LICENSE
}
