From f87e32ab419a1759edd942d9d93149fb66a522fa 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 | 21 +++++++++++++++++++++ 1 file changed, 21 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..e6634eeded5a --- /dev/null +++ b/srcpkgs/python3-execnet/template @@ -0,0 +1,21 @@ +# 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="https://github.com/pytest-dev/execnet/archive/refs/tags/v${version}.tar.gz" +checksum=d53787346558395f2cf8c570f4a9e2457eecde972429bf00c423a40b1f325765 + +export SETUPTOOLS_SCM_PRETEND_VERSION="$version" + +post_install() { + vlicense LICENSE +} From f2acfed26d97ff8b3c33e0f57d13b0b7fdab759b 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 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..d36a05bd46f1 --- /dev/null +++ b/srcpkgs/python3-pytest-forked/template @@ -0,0 +1,23 @@ +# 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="https://github.com/pytest-dev/pytest-forked/archive/refs/tags/v${version}.tar.gz" +checksum=22f3a65ef24d45fa03c6fec0d4b582f5f02bea4df26966c1b9812d3a64b44ace +# tests only work inside tox +make_check=no + +export SETUPTOOLS_SCM_PRETEND_VERSION="$version" + +post_install() { + vlicense LICENSE +} From fc34c7110ede0f812e071d8195ee444e2b22be8f 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 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..3e9bef9bd382 --- /dev/null +++ b/srcpkgs/python3-pytest-xdist/template @@ -0,0 +1,23 @@ +# 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="https://github.com/pytest-dev/pytest-xdist/archive/refs/tags/v${version}.tar.gz" +checksum=b0623f7b0e190175f46dbc939cc143ca49af2e5bdc70f2627c083b3ed1109f26 +# tests only work in tox +make_check=no + +export SETUPTOOLS_SCM_PRETEND_VERSION="$version" + +post_install() { + vlicense LICENSE +} From 866c1e371115820e1a953033aea60d596c8ca0f3 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 a733a521fb3d..97dc7995d58b 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