From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] [PATCH] python-utils-r1.eclass: epytest, use NO_COLOR rather than NOCOLOR
Date: Mon, 11 Dec 2023 20:27:14 +0100 [thread overview]
Message-ID: <15796cf6bdf1633a50e10ac52083462f177a7767.camel@gentoo.org> (raw)
In-Reply-To: <4c6f48a8-ba55-4ae4-b4fa-ebbaae95c155@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]
On Mon, 2023-12-11 at 13:57 -0500, Eli Schwartz wrote:
> On 12/2/23 7:44 AM, Michał Górny wrote:
> > Update epytest to respect the modern NO_COLOR variable rather than
> > Portage's old NOCOLOR. Adjust it to correctly check whether it is set
> > at all rather than to a specific value, to match the behavior of pytest
> > itself.
> >
> > Signed-off-by: Michał Górny <mgorny@gentoo.org>
> > ---
> > eclass/python-utils-r1.eclass | 11 ++---------
> > 1 file changed, 2 insertions(+), 9 deletions(-)
> >
> > diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
> > index 394f64a5d139..da9cb820840f 100644
> > --- a/eclass/python-utils-r1.eclass
> > +++ b/eclass/python-utils-r1.eclass
> > @@ -1336,15 +1336,8 @@ epytest() {
> > _python_check_EPYTHON
> > _python_check_occluded_packages
> >
> > - local color
> > - case ${NOCOLOR} in
> > - true|yes)
> > - color=no
> > - ;;
> > - *)
> > - color=yes
> > - ;;
> > - esac
> > + local color=yes
> > + [[ ${NO_COLOR} ]] && color=no
>
>
> [[ -v NO_COLOR ]]
>
> This is processed by the pytest code:
>
> ```
> if "NO_COLOR" in os.environ:
> return False
> ```
>
That looks wrong. Per [1]:
> […] NO_COLOR environment variable that, when present and not an empty
string (regardless of its value), prevents the addition of ANSI color.
So hey, I'm actually fixing pytest ;-).
[1] https://no-color.org/
--
Best regards,
Michał Górny
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]
next prev parent reply other threads:[~2023-12-11 19:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-02 12:44 [gentoo-dev] [PATCH] python-utils-r1.eclass: epytest, use NO_COLOR rather than NOCOLOR Michał Górny
2023-12-11 18:57 ` Eli Schwartz
2023-12-11 19:27 ` Michał Górny [this message]
2023-12-11 20:22 ` Eli Schwartz
2023-12-11 19:30 ` Ulrich Mueller
2023-12-11 20:21 ` Eli Schwartz
2023-12-11 20:38 ` Ulrich Mueller
2023-12-11 21:11 ` Toralf Förster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=15796cf6bdf1633a50e10ac52083462f177a7767.camel@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox