From 94f280d2e72a3f30287922772fb31ba60cca00db Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 13 May 2022 02:10:50 -0400 Subject: [PATCH 1/4] New package: python3-execnet-1.9.0 --- srcpkgs/python3-execnet/template | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 srcpkgs/python3-execnet/template diff --git a/srcpkgs/python3-execnet/template b/srcpkgs/python3-execnet/template new file mode 100644 index 000000000000..815555860209 --- /dev/null +++ b/srcpkgs/python3-execnet/template @@ -0,0 +1,19 @@ +# Template file for 'python3-execnet' +pkgname=python3-execnet +version=1.9.0 +revision=1 +wrksrc="${pkgname#python3-}-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools python3-setuptools_scm" +checkdepends="python3-pytest" +short_desc="Distributed Python deployment and communication" +maintainer="classabbyamp " +license="MIT" +homepage="https://codespeak.net/execnet/" +changelog="https://raw.githubusercontent.com/pytest-dev/execnet/master/CHANGELOG.rst" +distfiles="${PYPI_SITE}/e/execnet/execnet-${version}.tar.gz" +checksum=8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5 + +post_install() { + vlicense LICENSE +} From 123eab4ae39ce48e184faff222efabb269d9463d Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 13 May 2022 02:11:12 -0400 Subject: [PATCH 2/4] New package: python3-pytest-forked-1.4.0 --- srcpkgs/python3-pytest-forked/template | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 srcpkgs/python3-pytest-forked/template diff --git a/srcpkgs/python3-pytest-forked/template b/srcpkgs/python3-pytest-forked/template new file mode 100644 index 000000000000..df82db9de161 --- /dev/null +++ b/srcpkgs/python3-pytest-forked/template @@ -0,0 +1,21 @@ +# Template file for 'python3-pytest-forked' +pkgname=python3-pytest-forked +version=1.4.0 +revision=1 +wrksrc="${pkgname#python3-}-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools python3-setuptools_scm" +depends="python3-pytest" +short_desc="Run pytest tests in a forked subprocess" +maintainer="classabbyamp " +license="MIT" +homepage="https://github.com/pytest-dev/pytest-forked" +changelog="https://raw.githubusercontent.com/pytest-dev/pytest-forked/master/CHANGELOG.rst" +distfiles="${PYPI_SITE}/p/pytest-forked/pytest-forked-${version}.tar.gz" +checksum=8b67587c8f98cbbadfdd804539ed5455b6ed03802203485dd2f53c1422d7440e +# tests only work inside tox +make_check=no + +post_install() { + vlicense LICENSE +} From 619649c70b0203f381e355a3db6cac4664a21cfb Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 13 May 2022 02:11:49 -0400 Subject: [PATCH 3/4] New package: python3-pytest-xdist-2.5.0 --- srcpkgs/python3-pytest-xdist/template | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 srcpkgs/python3-pytest-xdist/template diff --git a/srcpkgs/python3-pytest-xdist/template b/srcpkgs/python3-pytest-xdist/template new file mode 100644 index 000000000000..36392a27d41d --- /dev/null +++ b/srcpkgs/python3-pytest-xdist/template @@ -0,0 +1,21 @@ +# Template file for 'python3-pytest-xdist' +pkgname=python3-pytest-xdist +version=2.5.0 +revision=1 +wrksrc="${pkgname#python3-}-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools python3-setuptools_scm" +depends="python3-pytest python3-pytest-forked python3-execnet" +short_desc="Pytest plugin for distributed testing & loop-on-failures testing modes" +maintainer="classabbyamp " +license="MIT" +homepage="https://github.com/pytest-dev/pytest-xdist" +changelog="https://raw.githubusercontent.com/pytest-dev/pytest-xdist/master/CHANGELOG.rst" +distfiles="${PYPI_SITE}/p/pytest-xdist/pytest-xdist-${version}.tar.gz" +checksum=4580deca3ff04ddb2ac53eba39d76cb5dd5edeac050cb6fbc768b0dd712b4edf +# tests only work in tox +make_check=no + +post_install() { + vlicense LICENSE +} From fb1014e08e45077e24fa5b443d72f1ada90a2358 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Sat, 14 May 2022 15:23:13 -0400 Subject: [PATCH 4/4] common/build-style/python3-*: add support for pytest-xdist if python3-pytest-xdist is included in checkdepends, use $XBPS_MAKEJOBS to run tests in parallel. --- common/build-style/python3-module.sh | 6 +++++- common/build-style/python3-pep517.sh | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh index 6ec5225d6aab..a0a694ee4a97 100644 --- a/common/build-style/python3-module.sh +++ b/common/build-style/python3-module.sh @@ -24,10 +24,14 @@ do_build() { } do_check() { + local testjobs if python3 -c 'import pytest' >/dev/null 2>&1; then + if python3 -c 'import xdist' >/dev/null 2>&1; then + testjobs="-n $XBPS_MAKEJOBS" + fi PYTHONPATH="$(cd build/lib* && pwd)" \ ${make_check_pre} \ - python3 -m pytest ${make_check_args} ${make_check_target} + python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target} else # Fall back to deprecated setup.py test orchestration without pytest if [ -z "$make_check_target" ]; then diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh index 62cfac7d67d3..1eeb4172492e 100644 --- a/common/build-style/python3-pep517.sh +++ b/common/build-style/python3-pep517.sh @@ -13,8 +13,12 @@ do_build() { } do_check() { + local testjobs if python3 -c 'import pytest' >/dev/null 2>&1; then - ${make_check_pre} python3 -m pytest ${make_check_args} ${make_check_target} + if python3 -c 'import xdist' >/dev/null 2>&1; then + testjobs="-n $XBPS_MAKEJOBS" + fi + ${make_check_pre} python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target} else msg_warn "Unable to determine tests for PEP517 Python templates" return 0