-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Clean up of CI scripts #28482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLN: Clean up of CI scripts #28482
Changes from 8 commits
61e503a
9d800c6
fb826c0
79fde27
456ca3c
c001857
89491b9
571e205
084a475
b174abd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,40 @@ | ||
#!/usr/bin/env python | ||
|
||
import math | ||
import os | ||
import sys | ||
import xml.etree.ElementTree as et | ||
|
||
|
||
def parse_results(filename): | ||
def main(filename): | ||
if not os.path.isfile(filename): | ||
return | ||
|
||
tree = et.parse(filename) | ||
root = tree.getroot() | ||
skipped = [] | ||
|
||
current_class = "" | ||
i = 1 | ||
assert i - 1 == len(skipped) | ||
for el in root.findall("testcase"): | ||
cn = el.attrib["classname"] | ||
for sk in el.findall("skipped"): | ||
old_class = current_class | ||
current_class = cn | ||
name = "{classname}.{name}".format( | ||
classname=current_class, name=el.attrib["name"] | ||
) | ||
msg = sk.attrib["message"] | ||
out = "" | ||
if old_class != current_class: | ||
ndigits = int(math.log(i, 10) + 1) | ||
|
||
# 4 for : + space + # + space | ||
out += "-" * (len(name + msg) + 4 + ndigits) + "\n" | ||
out += "#{i} {name}: {msg}".format(i=i, name=name, msg=msg) | ||
skipped.append(out) | ||
i += 1 | ||
assert i - 1 == len(skipped) | ||
assert i - 1 == len(skipped) | ||
# assert len(skipped) == int(root.attrib['skip']) | ||
return "\n".join(skipped) | ||
|
||
|
||
def main(): | ||
test_files = ["test-data-single.xml", "test-data-multiple.xml", "test-data.xml"] | ||
|
||
print("SKIPPED TESTS:") | ||
for fn in test_files: | ||
if os.path.isfile(fn): | ||
print(parse_results(fn)) | ||
return 0 | ||
yield None | ||
yield { | ||
"class_name": current_class, | ||
"test_name": el.attrib["name"], | ||
"message": sk.attrib["message"], | ||
} | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) | ||
print("SKIPPED TESTS:") | ||
i = 1 | ||
for file_type in ("-single", "-multi", ""): | ||
for test_data in main("test-data{}.xml".format(file_type)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor stylistic comment but does using a glob with path lib and iterating over results simplify this? Took me a bit to grok what we were doing here and I think a glob would be more stable if we added xml docs or changed name in future There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, didn't think about that. But in the next PR after this one I'll make the test just run once and remove the single/multi, so this loop will be removed. So not really worth to change it. |
||
if test_data is None: | ||
print("-" * 80) | ||
else: | ||
print( | ||
"#{i} {class_name}.{test_name}: {message}".format( | ||
**dict(test_data, i=i) | ||
) | ||
) | ||
i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this yields None? Does this not print skips that aren't associated to a class?
Haven't looked deeply but compared the number of skipped tests in this build to another from today for Linux Py35_Compat and numbers were way lower, so just curious if this is a reason for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
yield None
shouldn't prevent the next yield from happening, so it's not causing to miss tests.In the output of the skipped tests we print some division (i.e.
--------------
) between classes, so it's easier to see the different groups of tests that have been skipped.With this
yield None
this becomes as simple as theif
in the caller, and reduced significantly the code here, and makes things much compact and clear, which is the goal of this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was indeed a typo that was causing the skipped tests of the
multiple
file to not be printed, good catch. Should be fixed now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Looks like this is printing out more skips now though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. If you're checking the number of the last test, before this PR that is not the number of tests. The "single" and "multiple" tests were printed independently, so they start both from 1 and are not added up.
In this PR I'm fixing that, and the numbers don't reset. So, for example, in the
Linux py35_compat
, not it shows from 1 to 2,902. And before it was 1 to 568, and then 1 to 2334. The cases that I've checked, the number of the tests are the same, just the numbers in the second batch don't match.Does this explain the difference you saw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea makes sense - thanks for clarifying