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