From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-873252-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 0563959CA9
	for <garchives@archives.gentoo.org>; Tue, 29 Mar 2016 10:12:27 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id EACE221C022;
	Tue, 29 Mar 2016 10:12:23 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 71BBD21C022
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Mar 2016 10:12:23 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E7F9D340C93
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Mar 2016 10:12:21 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 78B7A856
	for <gentoo-commits@lists.gentoo.org>; Tue, 29 Mar 2016 10:12:17 +0000 (UTC)
From: "Alexander Berntsen" <bernalex@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Alexander Berntsen" <bernalex@gentoo.org>
Message-ID: <1459246236.aa7558a93d42d73ad916eecd2c3e8c6c294fe735.bernalex@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: /
X-VCS-Repository: proj/portage
X-VCS-Files: runtests
X-VCS-Directories: /
X-VCS-Committer: bernalex
X-VCS-Committer-Name: Alexander Berntsen
X-VCS-Revision: aa7558a93d42d73ad916eecd2c3e8c6c294fe735
X-VCS-Branch: master
Date: Tue, 29 Mar 2016 10:12:17 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 5106681e-9b57-4daf-821b-ce33f425269d
X-Archives-Hash: 826935128223a242f5138d82a321a9b4

commit:     aa7558a93d42d73ad916eecd2c3e8c6c294fe735
Author:     Sergei Trofimovich <siarheit <AT> google <DOT> com>
AuthorDate: Sat Mar 19 21:29:32 2016 +0000
Commit:     Alexander Berntsen <bernalex <AT> gentoo <DOT> org>
CommitDate: Tue Mar 29 10:10:36 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=aa7558a9

runtests: fix output for skipped pythons

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 <AT> google.com>
Signed-off-by: Alexander Berntsen <bernalex <AT> gentoo.org>
Reviewed-by:   Alexander Berntsen <bernalex <AT> gentoo.org>

 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__':