Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P7796
T188717 parse-testcases.py
Active
Public
Actions
Authored by
hashar
on Nov 13 2018, 12:32 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F27211783: T188717 parse-testcases.py
Nov 13 2018, 12:32 PM
2018-11-13 12:32:47 (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
()
testcases
=
ET
.
parse
(
args
.
file
)
.
findall
(
'.//testcase'
)
for
testcase
in
testcases
:
msg
=
'{name}'
no_assertions
=
'assertions'
not
in
testcase
.
attrib
zero_assertions
=
int
(
testcase
.
attrib
.
get
(
'assertions'
,
0
))
if
no_assertions
or
zero_assertions
==
0
:
msg
=
msg
+
' SKIPPED'
else
:
msg
=
msg
+
' {assertions} assertions'
try
:
print
(
msg
.
format_map
(
testcase
.
attrib
))
except
KeyError
as
e
:
print
(
'Missing key in '
,
testcase
.
attrib
)
raise
e
Event Timeline
hashar
created this paste.
Nov 13 2018, 12:32 PM
2018-11-13 12:32:47 (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