Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F27211787
T188717 parse-testsuites.py
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
hashar
Nov 13 2018, 12:33 PM
2018-11-13 12:33:23 (UTC+0)
Size
791 B
Referenced Files
None
Subscribers
None
T188717 parse-testsuites.py
View Options
#!/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
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6688828
Default Alt Text
T188717 parse-testsuites.py (791 B)
Attached To
Mode
P7797 T188717 parse-testsuites.py
Attached
Detach File
Event Timeline
Log In to Comment