public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention
@ 2024-01-04 17:09 Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir Michał Górny
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michał Górny @ 2024-01-04 17:09 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/python-utils-r1.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index abb55bd2e942..27fb92a75aca 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1344,6 +1344,11 @@ epytest() {
 		# count is more precise when we're dealing with a large number
 		# of tests
 		-o console_output_style=count
+		# minimize the temporary directory retention, the test suites
+		# of some packages can grow them pretty large and normally
+		# we don't need to preserve them
+		-o tmp_path_retention_count=0
+		-o tmp_path_retention_policy=failed
 	)
 
 	if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then
-- 
2.43.0



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

* [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir
  2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
@ 2024-01-04 17:09 ` Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 3/5] python-utils-r1.eclass, distutils-r1.eclass: Add EPYTEST_TIMEOUT Michał Górny
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-01-04 17:09 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 dev-python/tox/tox-4.11.4.ebuild | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/dev-python/tox/tox-4.11.4.ebuild b/dev-python/tox/tox-4.11.4.ebuild
index de87ecfd1e77..6715cafa12ae 100644
--- a/dev-python/tox/tox-4.11.4.ebuild
+++ b/dev-python/tox/tox-4.11.4.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -83,8 +83,4 @@ python_test() {
 	)
 
 	epytest
-
-	# tox leaves a *humonogous* tempdir which easily leads to ENOSPC
-	# when running in parallel with other packages
-	rm -r "${T}"/pytest* || die
 }
-- 
2.43.0



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

* [gentoo-dev] [PATCH 3/5] python-utils-r1.eclass, distutils-r1.eclass: Add EPYTEST_TIMEOUT
  2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir Michał Górny
@ 2024-01-04 17:09 ` Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 4/5] dev-python/trimesh: Use EPYTEST_TIMEOUT Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions Michał Górny
  3 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-01-04 17:09 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass    |  3 +++
 eclass/python-utils-r1.eclass | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 4e77237c3009..014669c8c47c 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -618,6 +618,9 @@ distutils_enable_tests() {
 			;;
 		pytest)
 			test_pkgs='>=dev-python/pytest-7.3.1[${PYTHON_USEDEP}]'
+			if [[ -n ${EPYTEST_TIMEOUT} ]]; then
+				test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
+			fi
 			if [[ ${EPYTEST_XDIST} ]]; then
 				test_pkgs+=' dev-python/pytest-xdist[${PYTHON_USEDEP}]'
 			fi
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 27fb92a75aca..22ab778b7e11 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1296,6 +1296,16 @@ _python_check_occluded_packages() {
 # parameter, when calling epytest.  The listed files will be entirely
 # skipped from test collection.
 
+# @ECLASS_VARIABLE: EPYTEST_TIMEOUT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-empty value, enables pytest-timeout plugin and sets
+# test timeout to the specified value.  This variable can be either set
+# in ebuilds that are known to hang, or by user to prevent hangs
+# in automated test environments.  If this variable is set prior
+# to calling distutils_enable_tests in distutils-r1, a test dependency
+# on dev-python/pytest-timeout is added automatically.
+
 # @ECLASS_VARIABLE: EPYTEST_XDIST
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -1381,6 +1391,18 @@ epytest() {
 		)
 	fi
 
+	if [[ -n ${EPYTEST_TIMEOUT} ]]; then
+		if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then
+			args+=(
+				-p timeout
+			)
+		fi
+
+		args+=(
+			"--timeout=${EPYTEST_TIMEOUT}"
+		)
+	fi
+
 	if [[ ${EPYTEST_XDIST} ]]; then
 		local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
 		if [[ ${jobs} -gt 1 ]]; then
-- 
2.43.0



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

* [gentoo-dev] [PATCH 4/5] dev-python/trimesh: Use EPYTEST_TIMEOUT
  2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 3/5] python-utils-r1.eclass, distutils-r1.eclass: Add EPYTEST_TIMEOUT Michał Górny
@ 2024-01-04 17:09 ` Michał Górny
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions Michał Górny
  3 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-01-04 17:09 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 dev-python/trimesh/trimesh-4.0.8.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dev-python/trimesh/trimesh-4.0.8.ebuild b/dev-python/trimesh/trimesh-4.0.8.ebuild
index 4a40c4a6730c..f666016b6084 100644
--- a/dev-python/trimesh/trimesh-4.0.8.ebuild
+++ b/dev-python/trimesh/trimesh-4.0.8.ebuild
@@ -46,16 +46,16 @@ RDEPEND="
 BDEPEND="
 	test? (
 		dev-python/mapbox_earcut[${PYTHON_USEDEP}]
-		dev-python/pytest-timeout[${PYTHON_USEDEP}]
 	)
 "
 
+EPYTEST_TIMEOUT=900
 EPYTEST_XDIST=1
 distutils_enable_tests pytest
 
 python_test() {
 	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
-	epytest -p timeout --timeout=900
+	epytest
 }
 
 pkg_postinst() {
-- 
2.43.0



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

* [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions
  2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
                   ` (2 preceding siblings ...)
  2024-01-04 17:09 ` [gentoo-dev] [PATCH 4/5] dev-python/trimesh: Use EPYTEST_TIMEOUT Michał Górny
@ 2024-01-04 17:09 ` Michał Górny
  3 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2024-01-04 17:09 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 014669c8c47c..e0a91001ef1f 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -2089,14 +2089,33 @@ _distutils-r1_post_python_install() {
 
 	local sitedir=${D%/}$(python_get_sitedir)
 	if [[ -d ${sitedir} ]]; then
+		local p
 		_distutils-r1_strip_namespace_packages "${sitedir}"
 
+		local bad_versions=()
+		mapfile -d $'\0' -t bad_versions < <(
+			find "${sitedir}" -maxdepth 1 '(' \
+				-name '*-0.0.0.dist-info' -o \
+				-name '*-UNKNOWN.dist-info' -o \
+				-name '*-0.0.0.egg-info' -o \
+				-name '*-UNKNOWN.egg-info' \
+				')' -print0
+		)
+
+		if [[ -n ${bad_versions[@]} ]]; then
+			eqawarn "The following Python packages were installed with invalid/suspicious"
+			eqawarn "versions in the site-packages directory:"
+			eqawarn
+			for p in "${bad_versions[@]}"; do
+				eqawarn "  ${p##*/}"
+			done
+		fi
+
 		local forbidden_package_names=(
 			examples test tests
 			.pytest_cache .hypothesis _trial_temp
 		)
 		local strays=()
-		local p
 		mapfile -d $'\0' -t strays < <(
 			find "${sitedir}" -maxdepth 1 -type f '!' '(' \
 					-name '*.egg-info' -o \
-- 
2.43.0



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

end of thread, other threads:[~2024-01-04 17:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 17:09 [gentoo-dev] [PATCH 1/5] python-utils-r1.eclass: Minimize pytest tempdir retention Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 2/5] dev-python/tox: epytest now takes care of removing tempdir Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 3/5] python-utils-r1.eclass, distutils-r1.eclass: Add EPYTEST_TIMEOUT Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 4/5] dev-python/trimesh: Use EPYTEST_TIMEOUT Michał Górny
2024-01-04 17:09 ` [gentoo-dev] [PATCH 5/5] distutils-r1.eclass: QA-warn about invalid package versions Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox