# Template file for 'python-pytest'
pkgname=python-pytest
version=4.6.9
revision=3
wrksrc="pytest-${version}"
build_style=python2-module
hostmakedepends="python-setuptools"
depends="python-atomicwrites python-attrs>=17.4.0 python-funcsigs
 python-more-itertools python-pluggy>=0.12.0 python-py>=1.6.0
 python-setuptools python-pathlib2 python-six>=1.10.0
 python-wcwidth python-hypothesis python-importlib_metadata
 python-packaging"
checkdepends="$depends python-mock"
short_desc="Simple powerful testing with Python 2"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://pytest.org/en/latest/"
changelog="https://docs.pytest.org/en/latest/changelog.html"
distfiles="${PYPI_SITE}/p/pytest/pytest-${version}.tar.gz"
checksum=19e8f75eac01dd3f211edd465b39efbcbdc8fc5f7866d7dd49fedb30d8adf339
alternatives="
 pytest:pytest:/usr/bin/pytest2
 pytest:py.test:/usr/bin/py.test2"

post_patch() {
	vsed -i setup.py \
		-e '/setup_requires=/d' \
		-e "s|use_scm_version=.*|version=\"${version}\",|"
	# This merely check if pytest executable was generated
	rm testing/test_entry_points.py
}

do_check() {
	# Don't use tox, tox will use its own environment instead of system
	# package
	PYTHONPATH=$(pwd)/build/lib python2 -m pytest
}

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