public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] python-utils-r1.eclass: epytest, force color output to match NOCOLOR
@ 2021-12-11  7:34 Michał Górny
  0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2021-12-11  7:34 UTC (permalink / raw)
  To: gentoo-dev; +Cc: Michał Górny

Force pytest color output on or off based on the presence and value
of NOCOLOR envvar.  This fixes inconsistent use of colors that largely
depended on upstream pytest settings.

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

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 22e00c56815d..225f781cc31f 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1291,6 +1291,16 @@ epytest() {
 
 	_python_check_EPYTHON
 
+	local color
+	case ${NOCOLOR} in
+		true|yes)
+			color=no
+			;;
+		*)
+			color=yes
+			;;
+	esac
+
 	local args=(
 		# verbose progress reporting and tracebacks
 		-vv
@@ -1302,6 +1312,8 @@ epytest() {
 		# override filterwarnings=error, we do not really want -Werror
 		# for end users, as it tends to fail on new warnings from deps
 		-Wdefault
+		# override color output
+		"--color=${color}"
 	)
 	local x
 	for x in "${EPYTEST_DESELECT[@]}"; do
-- 
2.34.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-11  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11  7:34 [gentoo-dev] [PATCH] python-utils-r1.eclass: epytest, force color output to match NOCOLOR 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