From 5ca121274b93bf3ee42534fb5754b5aa2caaf04d Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 10 May 2024 15:26:15 -0500 Subject: [PATCH] Handle runs of sub-tests where no warnings arise --- reporting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reporting.py b/reporting.py index b57a3497..63ac926e 100644 --- a/reporting.py +++ b/reporting.py @@ -103,7 +103,7 @@ def pytest_json_modifyreport(json_report): # doesn't store a full stack of where it was issued from. The resulting # warnings will be in order of the first time each warning is issued since # collections.Counter is ordered just like dict(). - counted_warnings = Counter([frozenset(i.items()) for i in json_report['warnings']]) + counted_warnings = Counter([frozenset(i.items()) for i in json_report.get('warnings', dict())]) deduped_warnings = [{**dict(i), 'count': counted_warnings[i]} for i in counted_warnings] json_report['warnings'] = deduped_warnings