Skip to content

Commit 2854e03

Browse files
committed
Only show match errors at end of test
1 parent 9f7deb0 commit 2854e03

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/subtests/helpers.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def diff_summary(baseline, result, hash_library=None):
2323
# Test names must be identical
2424
diff_set(baseline_tests, result_tests, error='Test names are not identical.')
2525

26+
item_match_errors = [] # Raise a MatchError for all mismatched values at the end
27+
2628
for test in baseline_tests:
2729

2830
# Get baseline and result summary for the specific test
@@ -42,7 +44,13 @@ def diff_summary(baseline, result, hash_library=None):
4244

4345
for key in baseline_keys:
4446
error = f'Summary item {key} for {test} does not match.\n'
45-
diff_dict_item(baseline_summary[key], result_summary[key], error=error)
47+
try:
48+
diff_dict_item(baseline_summary[key], result_summary[key], error=error)
49+
except MatchError as e:
50+
item_match_errors.append(str(e))
51+
52+
if len(item_match_errors) > 0:
53+
raise MatchError('\n\n----------\n\n'.join(item_match_errors))
4654

4755

4856
def diff_set(baseline, result, error=''):

0 commit comments

Comments
 (0)