Skip to content

Commit ccda286

Browse files
committed
BLD/TST/CI: add script to show skipped tests at the end of a build
1 parent 4c2d050 commit ccda286

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ script:
4949

5050
after_script:
5151
- ci/print_versions.py
52+
- ci/print_skipped.py /tmp/nosetests.xml

ci/print_skipped.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env python
2+
3+
import sys
4+
import math
5+
import xml.etree.ElementTree as et
6+
7+
8+
def parse_results(filename):
9+
tree = et.parse(filename)
10+
root = tree.getroot()
11+
skipped = []
12+
13+
current_class = old_class = ''
14+
i = 1
15+
assert i - 1 == len(skipped)
16+
for el in root.findall('testcase'):
17+
cn = el.attrib['classname']
18+
for sk in el.findall('skipped'):
19+
old_class = current_class
20+
current_class = cn
21+
name = '{classname}.{name}'.format(classname=current_class,
22+
name=el.attrib['name'])
23+
msg = sk.attrib['message']
24+
out = ''
25+
if old_class != current_class:
26+
ndigits = int(math.log(i, 10) + 1)
27+
out += ('-' * (len(name + msg) + 4 + ndigits) + '\n') # 4 for : + space + # + space
28+
out += '#{i} {name}: {msg}'.format(i=i, name=name, msg=msg)
29+
skipped.append(out)
30+
i += 1
31+
assert i - 1 == len(skipped)
32+
assert i - 1 == len(skipped)
33+
assert len(skipped) == int(root.attrib['skip'])
34+
return '\n'.join(skipped)
35+
36+
37+
def main(args):
38+
print('SKIPPED TESTS:')
39+
print(parse_results(args.filename))
40+
return 0
41+
42+
43+
def parse_args():
44+
import argparse
45+
parser = argparse.ArgumentParser()
46+
parser.add_argument('filename', help='XUnit file to parse')
47+
return parser.parse_args()
48+
49+
50+
if __name__ == '__main__':
51+
sys.exit(main(parse_args()))

ci/script.sh

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,5 @@ if [ x"$LOCALE_OVERRIDE" != x"" ]; then
99

1010
fi
1111

12-
echo nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas;
13-
nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas;
14-
15-
# if [ x"$VBENCH" == x"true" ]; then
16-
# python vb_suite/perf_HEAD.py;
17-
# exit
18-
# fi
12+
echo nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml
13+
nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml

0 commit comments

Comments
 (0)