Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7797
T188717 parse-testsuites.py
Active
Public
Actions
Authored by
hashar
on Nov 13 2018, 12:33 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F27211787: T188717 parse-testsuites.py
Nov 13 2018, 12:33 PM
2018-11-13 12:33:23 (UTC+0)
Subscribers
None
#!/usr/bin/env python3
import
argparse
import
xml.etree.ElementTree
as
ET
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'file'
,
help
=
'Junit file to process'
)
args
=
parser
.
parse_args
()
testsuites
=
ET
.
parse
(
args
.
file
)
.
findall
(
'.//testsuite'
)
for
testsuite
in
testsuites
:
msg
=
'{name}'
skipped
=
(
'skipped'
in
testsuite
.
attrib
and
int
(
testsuite
.
attrib
[
'skipped'
])
>
0
)
no_tests
=
(
int
(
testsuite
.
attrib
[
'tests'
])
==
0
and
int
(
testsuite
.
attrib
[
'assertions'
])
==
0
)
if
skipped
or
no_tests
:
msg
=
msg
+
' SKIPPED'
else
:
msg
=
msg
+
' {tests} tests'
try
:
print
(
msg
.
format_map
(
testsuite
.
attrib
))
except
KeyError
as
e
:
print
(
'Missing key in '
,
testsuite
.
attrib
)
raise
e
Event Timeline
hashar
created this paste.
Nov 13 2018, 12:33 PM
2018-11-13 12:33:23 (UTC+0)
hashar
mentioned this in
T188717: Move Wikibase to using the normal mediawiki extension (quibble) jobs
.
Nov 13 2018, 12:37 PM
2018-11-13 12:37:52 (UTC+0)
Log In to Comment