Skip to content
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

Use a list for tests in src/tests/run.py #78463

Merged
merged 1 commit into from
Nov 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def parse_test_results_xml_file(args, item, item_name, tests, assemblies):
Args:
xml_result_file : results xml file to parse
args : arguments
tests : dictionary of individual test results
tests : list of individual test results
assemblies : dictionary of per-assembly aggregations
"""

Expand Down Expand Up @@ -1242,14 +1242,13 @@ def parse_test_results_xml_file(args, item, item_name, tests, assemblies):
if test_location_on_filesystem is None or not os.path.isfile(test_location_on_filesystem):
test_location_on_filesystem = None
test_output = test.findtext("output")
assert tests[test_name] == None
tests[test_name] = defaultdict(lambda: None, {
tests.append(defaultdict(lambda: None, {
"name": test_name,
"test_path": test_location_on_filesystem,
"result" : result,
"time": time,
"test_output": test_output
})
}))
if result == "Pass":
assembly_info["passed"] += 1
elif result == "Fail":
Expand All @@ -1273,7 +1272,6 @@ def print_summary(tests, assemblies):
failed_tests = []

for test in tests:
test = tests[test]
if test["result"] == "Fail":
print("Failed test: %s" % test["name"])

Expand Down Expand Up @@ -1340,7 +1338,7 @@ def create_repro(args, env, tests):
"""
assert tests is not None

failed_tests = [tests[item] for item in tests if tests[item]["result"] == "Fail" and tests[item]["test_path"] is not None]
failed_tests = [test for test in tests if test["result"] == "Fail" and test["test_path"] is not None]
if len(failed_tests) == 0:
return

Expand Down Expand Up @@ -1385,7 +1383,7 @@ def main(args):

if not args.skip_test_run:
assemblies = defaultdict(lambda: None)
tests = defaultdict(lambda: None)
tests = []
parse_test_results(args, tests, assemblies)
print_summary(tests, assemblies)
create_repro(args, env, tests)
Expand Down