Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest
@ 2021-06-08  3:48 ahesford
  2021-06-08  4:16 ` [PR PATCH] [Updated] " ahesford
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ahesford @ 2021-06-08  3:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

There is a new pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages pytest
https://github.com/void-linux/void-packages/pull/31354

build-style/python3-{module,pep517}.sh: fix check for pytest
Relying on `python3 -m pytest --help` to test for pytest can fail
because the pytest packages's __main__ is still invoked; this can
trigger import problems and falsely indicate that pytest is missing.

A simpler test is to just confirm that pytest is importable. If so, the
interpreter returns 0. Otherwise, an ImportError is thrown and the
interpreter will return 1.


A patch file from https://github.com/void-linux/void-packages/pull/31354.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pytest-31354.patch --]
[-- Type: text/x-diff, Size: 1763 bytes --]

From a00727b9dd903a14ee9d7684585dc4103145fa30 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 7 Jun 2021 23:41:26 -0400
Subject: [PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest

Relying on `python3 -m pytest --help` to test for pytest can fail
because the pytest packages's __main__ is still invoked; this can
trigger import problems and falsely indicate that pytest is missing.

A simpler test is to just confirm that pytest is importable. If so, the
interpreter returns 0. Otherwise, an ImportError is thrown and the
interpreter will return 1.
---
 common/build-style/python3-module.sh | 2 +-
 common/build-style/python3-pep517.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh
index ad5fdff252b3..8b87c2df60bb 100644
--- a/common/build-style/python3-module.sh
+++ b/common/build-style/python3-module.sh
@@ -24,7 +24,7 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
 		python3 -m pytest ${make_check_args} ${make_check_target}
 	else
 		# Fall back to deprecated setup.py test orchestration without pytest
diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh
index 4051185a28e6..075f954a1a69 100644
--- a/common/build-style/python3-pep517.sh
+++ b/common/build-style/python3-pep517.sh
@@ -13,7 +13,7 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
 		python3 -m pytest ${make_check_args} ${make_check_target}
 	else
 		msg_warn "Unable to determine tests for PEP517 Python templates"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] build-style/python3-{module,pep517}.sh: fix check for pytest
  2021-06-08  3:48 [PR PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest ahesford
@ 2021-06-08  4:16 ` ahesford
  2021-06-08  5:00 ` ahesford
  2021-06-08 17:53 ` [PR PATCH] [Closed]: build-style/python3-{module,pep517}.sh: improve pytest usage ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: ahesford @ 2021-06-08  4:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages pytest
https://github.com/void-linux/void-packages/pull/31354

build-style/python3-{module,pep517}.sh: fix check for pytest
Relying on `python3 -m pytest --help` to test for pytest can fail
because the pytest packages's __main__ is still invoked; this can
trigger import problems and falsely indicate that pytest is missing.

A simpler test is to just confirm that pytest is importable. If so, the
interpreter returns 0. Otherwise, an ImportError is thrown and the
interpreter will return 1.


A patch file from https://github.com/void-linux/void-packages/pull/31354.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pytest-31354.patch --]
[-- Type: text/x-diff, Size: 2370 bytes --]

From 879c11675f52b0f234ae917b28d67b764815a272 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 7 Jun 2021 23:41:26 -0400
Subject: [PATCH] build-style/python3-{module,pep517}.sh: improve pytest check
 and run

1. Relying on `python3 -m pytest --help` to test for pytest can fail
   because the pytest packages's __main__ is still invoked; this can
   trigger import problems and falsely indicate that pytest is missing.
   A simpler test is to just confirm that pytest is importable. If so,
   the interpreter returns 0. Otherwise, an ImportError is thrown and
   the interpreter will return 1.

2. Many templates require a custom do_check just to set PYTHONPATH to
   either a build directory (especially for compiled extensions) or some
   subdirectory of the source tree. Setting PYTHONPATH automatically to
   the build directory should drastically reduce the need for custom
   do_check in py3 templates.
---
 common/build-style/python3-module.sh | 5 +++--
 common/build-style/python3-pep517.sh | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh
index ad5fdff252b3..093bdae8a006 100644
--- a/common/build-style/python3-module.sh
+++ b/common/build-style/python3-module.sh
@@ -24,8 +24,9 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
-		python3 -m pytest ${make_check_args} ${make_check_target}
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
+		PYTHONPATH="$(cd build/lib* && pwd)" \
+			python3 -m pytest ${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 4051185a28e6..944f37daf441 100644
--- a/common/build-style/python3-pep517.sh
+++ b/common/build-style/python3-pep517.sh
@@ -13,8 +13,9 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
-		python3 -m pytest ${make_check_args} ${make_check_target}
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
+		PYTHONPATH="$(cd build/lib* && pwd)" \
+			python3 -m pytest ${make_check_args} ${make_check_target}
 	else
 		msg_warn "Unable to determine tests for PEP517 Python templates"
 		return 0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] build-style/python3-{module,pep517}.sh: fix check for pytest
  2021-06-08  3:48 [PR PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest ahesford
  2021-06-08  4:16 ` [PR PATCH] [Updated] " ahesford
@ 2021-06-08  5:00 ` ahesford
  2021-06-08 17:53 ` [PR PATCH] [Closed]: build-style/python3-{module,pep517}.sh: improve pytest usage ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: ahesford @ 2021-06-08  5:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 726 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages pytest
https://github.com/void-linux/void-packages/pull/31354

build-style/python3-{module,pep517}.sh: fix check for pytest
Relying on `python3 -m pytest --help` to test for pytest can fail
because the pytest packages's __main__ is still invoked; this can
trigger import problems and falsely indicate that pytest is missing.

A simpler test is to just confirm that pytest is importable. If so, the
interpreter returns 0. Otherwise, an ImportError is thrown and the
interpreter will return 1.


A patch file from https://github.com/void-linux/void-packages/pull/31354.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pytest-31354.patch --]
[-- Type: text/x-diff, Size: 22206 bytes --]

From 9e77e8559d1a2a1b68777f59cf5e244530f0f1e7 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Mon, 7 Jun 2021 23:41:26 -0400
Subject: [PATCH 01/24] build-style/python3-{module,pep517}.sh: improve pytest
 usage

1. Relying on `python3 -m pytest --help` to test for pytest can fail
   because the pytest packages's __main__ is still invoked; this can
   trigger import problems and falsely indicate that pytest is missing.
   A simpler test is to just confirm that pytest is importable. If so,
   the interpreter returns 0. Otherwise, an ImportError is thrown and
   the interpreter will return 1.

2. Many templates require a custom do_check just to set PYTHONPATH to
   either a build directory (especially for compiled extensions) or some
   subdirectory of the source tree. Setting PYTHONPATH automatically to
   the build directory should drastically reduce the need for custom
   do_check in py3 templates. (This only applies to python3-module.sh
   because pep517 builders will have unpredictable build directories.)
---
 common/build-style/python3-module.sh | 5 +++--
 common/build-style/python3-pep517.sh | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/common/build-style/python3-module.sh b/common/build-style/python3-module.sh
index ad5fdff252b3..093bdae8a006 100644
--- a/common/build-style/python3-module.sh
+++ b/common/build-style/python3-module.sh
@@ -24,8 +24,9 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
-		python3 -m pytest ${make_check_args} ${make_check_target}
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
+		PYTHONPATH="$(cd build/lib* && pwd)" \
+			python3 -m pytest ${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 4051185a28e6..075f954a1a69 100644
--- a/common/build-style/python3-pep517.sh
+++ b/common/build-style/python3-pep517.sh
@@ -13,7 +13,7 @@ do_build() {
 }
 
 do_check() {
-	if python3 -m pytest --help >/dev/null 2>&1; then
+	if python3 -c 'import pytest' >/dev/null 2>&1; then
 		python3 -m pytest ${make_check_args} ${make_check_target}
 	else
 		msg_warn "Unable to determine tests for PEP517 Python templates"

From ed155d39a11d73be04c98a33d9d44ce6724a64b3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:31:02 -0400
Subject: [PATCH 02/24] olm-python3: remove unnecessary custom do_check

---
 srcpkgs/olm-python3/template | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/srcpkgs/olm-python3/template b/srcpkgs/olm-python3/template
index a385714289f0..ac2c75272a27 100644
--- a/srcpkgs/olm-python3/template
+++ b/srcpkgs/olm-python3/template
@@ -8,7 +8,6 @@ build_style=python3-module
 hostmakedepends="python3-setuptools python3-cffi"
 makedepends="python3-devel libffi-devel olm-devel"
 depends="python3-cffi python3-future"
-checkdepends="python3-pytest python3-future"
 short_desc="Implementation of the Double Ratchet cryptographic ratchet - Python"
 maintainer="Adam Beckmeyer <adam_gpg@thebeckmeyers.xyz>"
 license="Apache-2.0"
@@ -21,7 +20,3 @@ make_check=no
 pre_build() {
 	make include/olm/olm.h
 }
-
-do_check() {
-	PYTHONPATH=$(cd build/lib.linux-* && pwd) python3 -m pytest
-}

From 9650d1805569a63183ae8f51cd3627706ecc7523 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:31:21 -0400
Subject: [PATCH 03/24] python3-Flask: remove unnecessary custom do_check

---
 srcpkgs/python3-Flask/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-Flask/template b/srcpkgs/python3-Flask/template
index 699115bfcd90..36932115048f 100644
--- a/srcpkgs/python3-Flask/template
+++ b/srcpkgs/python3-Flask/template
@@ -16,10 +16,6 @@ distfiles="${PYPI_SITE}/F/Flask/Flask-${version}.tar.gz"
 checksum=1c4c257b1892aec1398784c63791cbaa43062f1f7aeb555c4da961b20ee68f55
 conflicts="python-Flask>=0"
 
-do_check() {
-	PYTHONPATH=src/ python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE.rst
 }

From 46043efeaabdeeff80da8b2f3f47d34d699ac4ab Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:32:44 -0400
Subject: [PATCH 04/24] python3-Pebble: remove unnecessary custom do_check

---
 srcpkgs/python3-Pebble/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-Pebble/template b/srcpkgs/python3-Pebble/template
index b7ac57baa3e6..e834d8478dc9 100644
--- a/srcpkgs/python3-Pebble/template
+++ b/srcpkgs/python3-Pebble/template
@@ -13,7 +13,3 @@ license="LGPL-3.0-or-later"
 homepage="https://pebble.readthedocs.io/en/latest/"
 distfiles="${PYPI_SITE}/P/Pebble/Pebble-${version}.tar.gz"
 checksum=b0abdc8830c21307038d63454584f71c2943e542e4e9d4c86d67aebc06c3519b
-
-do_check() {
-	PYTHONPATH=$(pwd)/build/lib pytest
-}

From c7a7a8c816847d31ab8f463c95a92b86b166f03e Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:33:36 -0400
Subject: [PATCH 05/24] python3-Pillow: remove unnecessary custom do_check

---
 srcpkgs/python3-Pillow/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-Pillow/template b/srcpkgs/python3-Pillow/template
index 379e7add3856..ba8b361f6be9 100644
--- a/srcpkgs/python3-Pillow/template
+++ b/srcpkgs/python3-Pillow/template
@@ -17,10 +17,6 @@ changelog="https://raw.githubusercontent.com/python-pillow/Pillow/master/CHANGES
 distfiles="${PYPI_SITE}/P/Pillow/Pillow-${version}.tar.gz"
 checksum=a787ab10d7bb5494e5f76536ac460741788f1fbce851068d73a87ca7c35fc3e1
 
-do_check() {
-	PYTHONPATH=$(cd build/lib.linux-* && pwd) python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 9f8cb70b6b589ffd8d0fee41a6649bf03dc3af7b Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:34:28 -0400
Subject: [PATCH 06/24] python3-PyICU: remove unnecessary custom do_check

---
 srcpkgs/python3-PyICU/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-PyICU/template b/srcpkgs/python3-PyICU/template
index d4c1033a783b..2993af4e2620 100644
--- a/srcpkgs/python3-PyICU/template
+++ b/srcpkgs/python3-PyICU/template
@@ -16,10 +16,6 @@ changelog="https://gitlab.pyicu.org/main/pyicu/-/raw/main/CHANGES"
 distfiles="https://gitlab.pyicu.org/main/pyicu/-/archive/v${version}/pyicu-v${version}.tar.bz2"
 checksum=072672a2403bedb54240494ad8cbb8f443825b6e6c1a98f11a556d8adff96be0
 
-pre_check() {
-	export PYTHONPATH=$(cd build/lib* && pwd)
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 1fe09cbb1c6cf6cb6871235782daddab52970390 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:35:07 -0400
Subject: [PATCH 07/24] python3-colorclass: remove unnecessary custom do_check

---
 srcpkgs/python3-colorclass/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-colorclass/template b/srcpkgs/python3-colorclass/template
index 646f69b1316e..f70af63bfc0f 100644
--- a/srcpkgs/python3-colorclass/template
+++ b/srcpkgs/python3-colorclass/template
@@ -14,10 +14,6 @@ homepage="https://github.com/Robpol86/colorclass"
 distfiles="https://github.com/Robpol86/colorclass/archive/v${version}.tar.gz"
 checksum=@4b1dff3a5736f909f229429396131365d31cffac0c497bdf46a1fa61e8c2d6f7
 
-do_check() {
-	PYTHONPATH="${PWD}/build-${py3_ver}/lib" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 4c6faa7ce93f0ddbdb2895c938cdd4d92dc2190b Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:35:56 -0400
Subject: [PATCH 08/24] python3-humanize: remove unnecessary custom do_check

---
 srcpkgs/python3-humanize/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-humanize/template b/srcpkgs/python3-humanize/template
index c87482c4cdd6..1c0beac81f69 100644
--- a/srcpkgs/python3-humanize/template
+++ b/srcpkgs/python3-humanize/template
@@ -20,10 +20,6 @@ do_patch() {
 	sed -i "s/VERSION = .*$/VERSION = '${version}'/" src/humanize/__init__.py
 }
 
-do_check() {
-	PYTHONPATH="${PWD}/build/lib" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENCE
 }

From 47625de9932b628b414b8f419128afad6afa8321 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:36:07 -0400
Subject: [PATCH 09/24] python3-hyperframe: remove unnecessary custom do_check

---
 srcpkgs/python3-hyperframe/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-hyperframe/template b/srcpkgs/python3-hyperframe/template
index 172c3ba23ccc..44711dab7424 100644
--- a/srcpkgs/python3-hyperframe/template
+++ b/srcpkgs/python3-hyperframe/template
@@ -14,10 +14,6 @@ homepage="https://python-hyper.org/hyperframe/"
 distfiles="https://github.com/python-hyper/hyperframe/archive/v${version}.tar.gz"
 checksum=a126e1e0fb24135aa7ac53cefe11ad197d0c9a5e74f495c1236022b1e578a7a8
 
-do_check() {
-	PYTHONPATH="$(cd build/lib* && pwd)" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 1a51fb51939a3252b164394ffb0c56922e1de2d5 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:36:20 -0400
Subject: [PATCH 10/24] python3-icalendar: remove unnecessary custom do_check

---
 srcpkgs/python3-icalendar/template | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/srcpkgs/python3-icalendar/template b/srcpkgs/python3-icalendar/template
index f37ae5f3a02e..2899feb66f8a 100644
--- a/srcpkgs/python3-icalendar/template
+++ b/srcpkgs/python3-icalendar/template
@@ -4,6 +4,7 @@ version=4.0.7
 revision=1
 wrksrc="icalendar-${version}"
 build_style=python3-module
+make_check_target=src/icalendar/tests
 hostmakedepends="python3-setuptools"
 depends="python3-setuptools python3-dateutil python3-pytz"
 checkdepends="python3-dateutil python3-pytz python3-pytest python3-hypothesis"
@@ -15,10 +16,6 @@ distfiles="${PYPI_SITE}/i/icalendar/icalendar-${version}.tar.gz"
 checksum=0fc18d87f66e0b5da84fa731389496cfe18e4c21304e8f6713556b2e8724a7a4
 conflicts="python-icalendar>=0"
 
-do_check() {
-	PYTHONPATH=src python3 -m pytest src/icalendar/tests
-}
-
 post_install() {
 	vlicense LICENSE.rst LICENSE
 }

From 38e7576d45bca23ad6afeaa296be365aa255af2f Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:36:35 -0400
Subject: [PATCH 11/24] python3-marshmallow: remove unnecessary custom do_check

---
 srcpkgs/python3-marshmallow/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-marshmallow/template b/srcpkgs/python3-marshmallow/template
index 773b473cb23c..65939bde732f 100644
--- a/srcpkgs/python3-marshmallow/template
+++ b/srcpkgs/python3-marshmallow/template
@@ -15,10 +15,6 @@ changelog="https://raw.githubusercontent.com/marshmallow-code/marshmallow/dev/CH
 distfiles="${PYPI_SITE}/m/marshmallow/marshmallow-${version}.tar.gz"
 checksum=ba949379cb6ef73655f72075e82b31cf57012a5557ede642fc8614ab0354f869
 
-do_check() {
-	PYTHONPATH="${PWD}/build/lib" pytest3 -v
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 8a6caaac51dbf32c738b9fcb2f364549d6dcc01e Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:36:48 -0400
Subject: [PATCH 12/24] python3-msgpack: remove unnecessary custom do_check

---
 srcpkgs/python3-msgpack/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-msgpack/template b/srcpkgs/python3-msgpack/template
index dbcf1068f6d5..a50c56098d3c 100644
--- a/srcpkgs/python3-msgpack/template
+++ b/srcpkgs/python3-msgpack/template
@@ -13,7 +13,3 @@ license="Apache-2.0"
 homepage="https://msgpack.org/"
 distfiles="${PYPI_SITE}/m/msgpack/msgpack-${version}.tar.gz"
 checksum=9534d5cc480d4aff720233411a1f765be90885750b07df772380b34c10ecb5c0
-
-do_check() {
-	PYTHONPATH=$PWD/build/lib python3 -m pytest
-}

From 6d97a9798dd1065c5b08942ae5fd4efc08caf106 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:37:02 -0400
Subject: [PATCH 13/24] python3-outcome: remove unnecessary custom do_check

---
 srcpkgs/python3-outcome/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-outcome/template b/srcpkgs/python3-outcome/template
index f326b36ace81..b1fd6e6cf06e 100644
--- a/srcpkgs/python3-outcome/template
+++ b/srcpkgs/python3-outcome/template
@@ -14,10 +14,6 @@ homepage="https://github.com/python-trio/outcome"
 distfiles="${PYPI_SITE}/o/outcome/outcome-${version}.tar.gz"
 checksum=e862f01d4e626e63e8f92c38d1f8d5546d3f9cce989263c521b2e7990d186967
 
-do_check() {
-	PYTHONPATH=$(cd build/lib* && pwd) pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From cd8f5b1a6b7b4a96db8411bca259b10f03358c54 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:37:43 -0400
Subject: [PATCH 14/24] python3-pikepdf: remove unnecessary custom do_check

---
 srcpkgs/python3-pikepdf/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-pikepdf/template b/srcpkgs/python3-pikepdf/template
index c05d3605cb56..cc4a0f02bcd3 100644
--- a/srcpkgs/python3-pikepdf/template
+++ b/srcpkgs/python3-pikepdf/template
@@ -18,7 +18,3 @@ checksum=fcbb6e37426564ccaf6bb301616700277d426225895b00a64283a95ff648f3b9
 pre_build() {
 	vsed -e '/setuptools_scm_git_archive/d' -i setup.py
 }
-
-do_check() {
-	PYTHONPATH=$(cd build/lib* && pwd) python3 -m pytest
-}

From 652710684b2c060413b1862694faaee5c329cc84 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:38:01 -0400
Subject: [PATCH 15/24] python3-pyxattr: remove unnecessary custom do_check

---
 srcpkgs/python3-pyxattr/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-pyxattr/template b/srcpkgs/python3-pyxattr/template
index 170239f5f3d6..f7f075a7a3e3 100644
--- a/srcpkgs/python3-pyxattr/template
+++ b/srcpkgs/python3-pyxattr/template
@@ -14,7 +14,3 @@ license="LGPL-2.1-or-later"
 homepage="http://pyxattr.k1024.org/"
 distfiles="${PYPI_SITE}/p/pyxattr/pyxattr-${version}.tar.gz"
 checksum=68477027e6d3310669f98aaef15393bfcd9b2823d7a7f00a6f1d91a3c971ae64
-
-do_check() {
-	PYTHONPATH=$(cd build/lib* && pwd) python3 -m pytest
-}

From 4fd4d92b102d70807e47f6a9e9548976e82f6d82 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:38:19 -0400
Subject: [PATCH 16/24] python3-quart: remove unnecessary custom do_check

---
 srcpkgs/python3-quart/template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/python3-quart/template b/srcpkgs/python3-quart/template
index 21aa2705d4f0..335b7c3c608a 100644
--- a/srcpkgs/python3-quart/template
+++ b/srcpkgs/python3-quart/template
@@ -16,9 +16,8 @@ changelog="https://gitlab.com/pgjones/quart/-/blob/master/CHANGELOG.rst"
 distfiles="${homepage}/-/archive/${version}/${pkgname#*-}-${version}.tar.gz"
 checksum=d9fa92cfec967b8730ce75f90a454d0a687871960f5e334885e64bfae9d7cd3a
 
-do_check() {
-	vsed -e '/addopts/d' -i setup.cfg
-	PYTHONPATH=src python3 -m pytest
+pre_check() {
+	sed -e '/addopts/d' -i setup.cfg
 }
 
 post_install() {

From c84c9711c81c9b94461248cafca453ce4ee0a8f6 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:38:53 -0400
Subject: [PATCH 17/24] python3-sniffio: remove unnecessary custom do_check

---
 srcpkgs/python3-sniffio/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-sniffio/template b/srcpkgs/python3-sniffio/template
index af169ef60b12..6481ea76e58c 100644
--- a/srcpkgs/python3-sniffio/template
+++ b/srcpkgs/python3-sniffio/template
@@ -14,10 +14,6 @@ homepage="https://github.com/python-trio/sniffio"
 distfiles="${PYPI_SITE}/s/sniffio/sniffio-${version}.tar.gz"
 checksum=c4666eecec1d3f50960c6bdf61ab7bc350648da6c126e3cf6898d8cd4ddcd3de
 
-do_check() {
-	PYTHONPATH=$(cd build/lib* && pwd) pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 0640909f2f73dce2de952bcf154e153054d28ad5 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:39:07 -0400
Subject: [PATCH 18/24] python3-soupsieve: remove unnecessary custom do_check

---
 srcpkgs/python3-soupsieve/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-soupsieve/template b/srcpkgs/python3-soupsieve/template
index b74064c5312c..b7b2b55a36d8 100644
--- a/srcpkgs/python3-soupsieve/template
+++ b/srcpkgs/python3-soupsieve/template
@@ -13,10 +13,6 @@ homepage="https://facelessuser.github.io/soupsieve/"
 distfiles="${PYPI_SITE}/s/soupsieve/soupsieve-${version}.tar.gz"
 checksum=e2c1c5dee4a1c36bcb790e0fabd5492d874b8ebd4617622c4f6a731701060dda
 
-do_check() {
-	PYTHONPATH="${PWD}/build/lib" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE.md
 

From cbf0846a2304e6b3e282e4a793a0b1c60ef65d44 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:39:21 -0400
Subject: [PATCH 19/24] python3-ultrajson: remove unnecessary custom do_check

---
 srcpkgs/python3-ultrajson/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-ultrajson/template b/srcpkgs/python3-ultrajson/template
index 59415d1249b4..9d8af1e8bc05 100644
--- a/srcpkgs/python3-ultrajson/template
+++ b/srcpkgs/python3-ultrajson/template
@@ -15,10 +15,6 @@ homepage="https://github.com/ultrajson/ultrajson"
 distfiles="${PYPI_SITE}/u/ujson/ujson-${version}.tar.gz"
 checksum=c615a9e9e378a7383b756b7e7a73c38b22aeb8967a8bfbffd4741f7ffd043c4d
 
-do_check() {
-	PYTHONPATH="$(cd build/lib* && pwd)" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE.txt
 }

From 7e9557bf1062649685a35464606ef56fb2ed8406 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:39:33 -0400
Subject: [PATCH 20/24] python3-wsproto: remove unnecessary custom do_check

---
 srcpkgs/python3-wsproto/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-wsproto/template b/srcpkgs/python3-wsproto/template
index 241c28c93c64..672e36d66176 100644
--- a/srcpkgs/python3-wsproto/template
+++ b/srcpkgs/python3-wsproto/template
@@ -15,10 +15,6 @@ changelog="https://raw.githubusercontent.com/python-hyper/wsproto/master/CHANGEL
 distfiles="${PYPI_SITE}/w/wsproto/wsproto-${version}.tar.gz"
 checksum=868776f8456997ad0d9720f7322b746bbe9193751b5b290b7f924659377c8c38
 
-do_check() {
-	PYTHONPATH=src python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 1818a363d5583ba6cf31ce192a9153de5f7776d1 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:40:11 -0400
Subject: [PATCH 21/24] ssh-audit: remove unnecessary custom do_check

---
 srcpkgs/ssh-audit/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/ssh-audit/template b/srcpkgs/ssh-audit/template
index eef4fcb68ef8..14e9e31cfeec 100644
--- a/srcpkgs/ssh-audit/template
+++ b/srcpkgs/ssh-audit/template
@@ -14,10 +14,6 @@ distfiles="https://github.com/jtesta/ssh-audit/archive/v${version}.tar.gz"
 checksum=87c634171d3e0c69297fceeb98dead9a816d5d56c8dcd138f8411fdf58085b6f
 python_version=3
 
-do_check() {
-	PYTHONPATH=build/lib python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 	vman ssh-audit.1

From 087e9a96ebeae178fd5cd0408f6398fb730225d3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:41:17 -0400
Subject: [PATCH 22/24] streamlink: remove unnecessary custom do_check

---
 srcpkgs/streamlink/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/streamlink/template b/srcpkgs/streamlink/template
index b2165f07d927..5b2a5626c20b 100644
--- a/srcpkgs/streamlink/template
+++ b/srcpkgs/streamlink/template
@@ -19,10 +19,6 @@ checksum=c0ead9e961638d41cab9bd9677cdc701f2313bfd4d23cd8158410932839c62db
 
 export STREAMLINK_USE_PYCOUNTRY=1
 
-do_check() {
-	PYTHONPATH="${PWD}/build/lib" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 }

From 1f07a866a289ea5f030c2b63872d10e5b740d3d3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:46:40 -0400
Subject: [PATCH 23/24] python3-cryptography: remove unnecessary custom
 do_check

---
 srcpkgs/python3-cryptography/template | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/srcpkgs/python3-cryptography/template b/srcpkgs/python3-cryptography/template
index a90520afa60d..464e1c434500 100644
--- a/srcpkgs/python3-cryptography/template
+++ b/srcpkgs/python3-cryptography/template
@@ -24,10 +24,6 @@ if [ "$CROSS_BUILD" ]; then
 	export PYO3_CROSS_INCLUDE_DIR="${XBPS_CROSS_BASE}/usr/include"
 fi
 
-do_check() {
-	PYTHONPATH="$(cd build/lib* && pwd)" python3 -m pytest
-}
-
 post_install() {
 	vlicense LICENSE
 	vlicense LICENSE.BSD

From bdcca89474fbe3a1c9a7556d8a7761ea1c1637b1 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Jun 2021 00:47:47 -0400
Subject: [PATCH 24/24] python3-xmlschema: remove unnecessary custom do_check

---
 srcpkgs/python3-xmlschema/template | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/srcpkgs/python3-xmlschema/template b/srcpkgs/python3-xmlschema/template
index 576946da4efe..20b725f01d9b 100644
--- a/srcpkgs/python3-xmlschema/template
+++ b/srcpkgs/python3-xmlschema/template
@@ -6,7 +6,7 @@ wrksrc=xmlschema-${version}
 build_style=python3-module
 hostmakedepends="python3-setuptools python3-elementpath"
 depends="python3-elementpath"
-checkdepends="python3-lxml python3-Sphinx"
+checkdepends="python3-lxml python3-Sphinx python3-pytest"
 short_desc="XML Schema validator and decoder for Python"
 maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
 license="MIT"
@@ -14,10 +14,6 @@ homepage="https://github.com/sissaschool/xmlschema"
 distfiles="${PYPI_SITE}/x/xmlschema/xmlschema-${version}.tar.gz"
 checksum=31ddf77a44e4b121de212beeb2cc039e2e8b7a7a4f1678c9b29be1f5341aec52
 
-do_check() {
-	PYTHONPATH=$(pwd)/build/lib python3 -m unittest
-}
-
 post_install() {
 	vlicense LICENSE
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Closed]: build-style/python3-{module,pep517}.sh: improve pytest usage
  2021-06-08  3:48 [PR PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest ahesford
  2021-06-08  4:16 ` [PR PATCH] [Updated] " ahesford
  2021-06-08  5:00 ` ahesford
@ 2021-06-08 17:53 ` ahesford
  2 siblings, 0 replies; 4+ messages in thread
From: ahesford @ 2021-06-08 17:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

There's a closed pull request on the void-packages repository

build-style/python3-{module,pep517}.sh: improve pytest usage
https://github.com/void-linux/void-packages/pull/31354

Description:
1. Relying on `python3 -m pytest --help` to test for pytest can fail
   because the pytest packages's __main__ is still invoked; this can
   trigger import problems and falsely indicate that pytest is missing.
   A simpler test is to just confirm that pytest is importable. If so,
   the interpreter returns 0. Otherwise, an ImportError is thrown and
   the interpreter will return 1.

2. Many templates require a custom do_check just to set PYTHONPATH to
   either a build directory (especially for compiled extensions) or some
   subdirectory of the source tree. Setting PYTHONPATH automatically to
   the build directory should drastically reduce the need for custom
   do_check in py3 templates. (This only applies to python3-module.sh
   because pep517 builders will have unpredictable build directories.)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-08 17:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08  3:48 [PR PATCH] build-style/python3-{module,pep517}.sh: fix check for pytest ahesford
2021-06-08  4:16 ` [PR PATCH] [Updated] " ahesford
2021-06-08  5:00 ` ahesford
2021-06-08 17:53 ` [PR PATCH] [Closed]: build-style/python3-{module,pep517}.sh: improve pytest usage ahesford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).