-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a check for tests which are always skipped (#240)
* Add a check for tests which are always skipped This takes the form of a new script which crawls pytest XML reports and collates them into a single aggregate. It checks for tests which are skipped or missing in all of the reports. The aggregator can be run along with a suite of tox environments via `make collatd-test-report`, and a new CI job runs this in a build. * Don't run tests twice in CI As a first draft, tests ran twice (one for the "test" and once for the skipped test collator). Switch to upload/download of junitxml report data to pass the reports from the matrix to the collator.
- Loading branch information
Showing
4 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import argparse | ||
import sys | ||
from collections import defaultdict | ||
from xml.etree import ElementTree # nosec | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("FILES", nargs="+") | ||
args = parser.parse_args() | ||
|
||
tests_by_name = defaultdict(dict) | ||
for filename in args.FILES: | ||
tree = ElementTree.parse(filename) | ||
root = tree.getroot() | ||
|
||
for testcase in root.findall("./testsuite/testcase"): | ||
classname = testcase.get("classname") | ||
name = testcase.get("name") | ||
nodename = f"{classname.replace('.', '/')}.py::{name}" | ||
|
||
skip_node = testcase.find("skipped") | ||
if skip_node is not None: | ||
if "skipped" not in tests_by_name[nodename]: | ||
tests_by_name[nodename]["skipped"] = True | ||
else: | ||
tests_by_name[nodename]["skipped"] = False | ||
|
||
fail = False | ||
for nodename, attributes in tests_by_name.items(): | ||
if attributes.get("skipped") is True: | ||
print(f"ALWAYS SKIPPED: {nodename}") | ||
fail = True | ||
|
||
if fail: | ||
print("fail") | ||
sys.exit(1) | ||
print("ok") | ||
sys.exit(0) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters