From: Sergei Trofimovich <slyfox@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Sergei Trofimovich <siarheit@google.com>
Subject: [gentoo-portage-dev] [PATCH 2/2] runtests: fix output for skipped pythons
Date: Sat, 19 Mar 2016 21:29:32 +0000 [thread overview]
Message-ID: <1458422972-22690-1-git-send-email-slyfox@gentoo.org> (raw)
From: Sergei Trofimovich <siarheit@google.com>
I have Pythons 2.7 and 3.4 installed.
Before the patch I had the following output:
$ ./runtests pym/portage/tests/resolver/test_blocker.py
Testing with Python 2.7...
Testing with Python 3.4...
Summary:
| Version | Status
|--------------------
| 2.7 | PASS
| 3.3 | PASS
After the patch:
$ ./runtests pym/portage/tests/resolver/test_blocker.py
Testing with Python 2.7...
Skip Python 3.3...
Testing with Python 3.4...
Skip Python pypy...
Skip Python 3.5...
Summary:
| Version | Status
|--------------------
| 2.7 | PASS
| 3.4 | PASS
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
runtests | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/runtests b/runtests
index d492bc8..9135768 100755
--- a/runtests
+++ b/runtests
@@ -42,7 +42,7 @@ class Colors(object):
_COLORS_YES = ('y', 'yes', 'true')
_COLORS_NO = ('n', 'no', 'false')
- GOOD = BAD = NORMAL = ''
+ WARN = GOOD = BAD = NORMAL = ''
def __init__(self, colorize=None):
if colorize is None:
@@ -63,6 +63,7 @@ class Colors(object):
raise ValueError('--colors is invalid: %s' % colorize)
if colorize:
+ self.WARN = '\033[1;33m'
self.GOOD = '\033[1;32m'
self.BAD = '\033[1;31m'
self.NORMAL = '\033[0m'
@@ -135,11 +136,14 @@ def main(argv):
if os.access(prog, os.X_OK):
print('%sTesting with Python %s...%s' %
(colors.GOOD, ver, colors.NORMAL))
- statuses.append(subprocess.call(cmd))
+ statuses.append((ver, subprocess.call(cmd)))
elif not ignore_missing:
print('%sCould not find requested Python %s%s' %
(colors.BAD, ver, colors.NORMAL))
- statuses.append(1)
+ statuses.append((ver, 1))
+ else:
+ print('%sSkip Python %s...%s' %
+ (colors.WARN, ver, colors.NORMAL))
print()
finally:
if tempdir is not None:
@@ -154,7 +158,9 @@ def main(argv):
width = 10
header = '| %-*s | %s' % (width, 'Version', 'Status')
print('%s\n|%s' % (header, '-' * (len(header) - 1)))
- for ver, status in zip(pyversions, statuses):
+ exit_status = 0
+ for ver, status in statuses:
+ exit_status += status
if status:
color = colors.BAD
msg = 'FAIL'
@@ -163,7 +169,7 @@ def main(argv):
msg = 'PASS'
print('| %s%-*s%s | %s%s%s' %
(color, width, ver, colors.NORMAL, color, msg, colors.NORMAL))
- exit(sum(statuses))
+ exit(exit_status)
if __name__ == '__main__':
--
2.7.4
next reply other threads:[~2016-03-19 21:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-19 21:29 Sergei Trofimovich [this message]
2016-03-20 13:53 ` [gentoo-portage-dev] [PATCH 2/2] runtests: fix output for skipped pythons Alexander Berntsen
2016-03-24 22:33 ` Sergei Trofimovich
2016-03-29 10:12 ` Alexander Berntsen
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=1458422972-22690-1-git-send-email-slyfox@gentoo.org \
--to=slyfox@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=siarheit@google.com \
/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