1 |
From: Sergei Trofimovich <siarheit@××××××.com> |
2 |
|
3 |
I have Pythons 2.7 and 3.4 installed. |
4 |
|
5 |
Before the patch I had the following output: |
6 |
|
7 |
$ ./runtests pym/portage/tests/resolver/test_blocker.py |
8 |
Testing with Python 2.7... |
9 |
Testing with Python 3.4... |
10 |
|
11 |
Summary: |
12 |
| Version | Status |
13 |
|-------------------- |
14 |
| 2.7 | PASS |
15 |
| 3.3 | PASS |
16 |
|
17 |
After the patch: |
18 |
|
19 |
$ ./runtests pym/portage/tests/resolver/test_blocker.py |
20 |
|
21 |
Testing with Python 2.7... |
22 |
Skip Python 3.3... |
23 |
Testing with Python 3.4... |
24 |
Skip Python pypy... |
25 |
Skip Python 3.5... |
26 |
|
27 |
Summary: |
28 |
| Version | Status |
29 |
|-------------------- |
30 |
| 2.7 | PASS |
31 |
| 3.4 | PASS |
32 |
|
33 |
Signed-off-by: Sergei Trofimovich <siarheit@××××××.com> |
34 |
--- |
35 |
runtests | 16 +++++++++++----- |
36 |
1 file changed, 11 insertions(+), 5 deletions(-) |
37 |
|
38 |
diff --git a/runtests b/runtests |
39 |
index d492bc8..9135768 100755 |
40 |
--- a/runtests |
41 |
+++ b/runtests |
42 |
@@ -42,7 +42,7 @@ class Colors(object): |
43 |
_COLORS_YES = ('y', 'yes', 'true') |
44 |
_COLORS_NO = ('n', 'no', 'false') |
45 |
|
46 |
- GOOD = BAD = NORMAL = '' |
47 |
+ WARN = GOOD = BAD = NORMAL = '' |
48 |
|
49 |
def __init__(self, colorize=None): |
50 |
if colorize is None: |
51 |
@@ -63,6 +63,7 @@ class Colors(object): |
52 |
raise ValueError('--colors is invalid: %s' % colorize) |
53 |
|
54 |
if colorize: |
55 |
+ self.WARN = '\033[1;33m' |
56 |
self.GOOD = '\033[1;32m' |
57 |
self.BAD = '\033[1;31m' |
58 |
self.NORMAL = '\033[0m' |
59 |
@@ -135,11 +136,14 @@ def main(argv): |
60 |
if os.access(prog, os.X_OK): |
61 |
print('%sTesting with Python %s...%s' % |
62 |
(colors.GOOD, ver, colors.NORMAL)) |
63 |
- statuses.append(subprocess.call(cmd)) |
64 |
+ statuses.append((ver, subprocess.call(cmd))) |
65 |
elif not ignore_missing: |
66 |
print('%sCould not find requested Python %s%s' % |
67 |
(colors.BAD, ver, colors.NORMAL)) |
68 |
- statuses.append(1) |
69 |
+ statuses.append((ver, 1)) |
70 |
+ else: |
71 |
+ print('%sSkip Python %s...%s' % |
72 |
+ (colors.WARN, ver, colors.NORMAL)) |
73 |
print() |
74 |
finally: |
75 |
if tempdir is not None: |
76 |
@@ -154,7 +158,9 @@ def main(argv): |
77 |
width = 10 |
78 |
header = '| %-*s | %s' % (width, 'Version', 'Status') |
79 |
print('%s\n|%s' % (header, '-' * (len(header) - 1))) |
80 |
- for ver, status in zip(pyversions, statuses): |
81 |
+ exit_status = 0 |
82 |
+ for ver, status in statuses: |
83 |
+ exit_status += status |
84 |
if status: |
85 |
color = colors.BAD |
86 |
msg = 'FAIL' |
87 |
@@ -163,7 +169,7 @@ def main(argv): |
88 |
msg = 'PASS' |
89 |
print('| %s%-*s%s | %s%s%s' % |
90 |
(color, width, ver, colors.NORMAL, color, msg, colors.NORMAL)) |
91 |
- exit(sum(statuses)) |
92 |
+ exit(exit_status) |
93 |
|
94 |
|
95 |
if __name__ == '__main__': |
96 |
-- |
97 |
2.7.4 |