Skip to content

Commit

Permalink
Test if plugin errors from tests are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
Famlam authored and frodrigo committed Oct 29, 2024
1 parent 7ab7d7a commit 834f2e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plugins/Plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ def check_err(self, errors, log="Valid errors expected", expected=None):
break
assert found, str(expected) + " Not found in the errors list" + str(errors)

# Check if errors are also unique
errors_hashableitems = list(map(lambda e: str(e["class"]) + "|" + str(e.get("subclass", "")), errors))
non_unique = set([x for x in errors_hashableitems if errors_hashableitems.count(x) > 1])
assert len(non_unique) == 0, "Duplicate entry with class|subclass:\n - " + '\n - '.join(non_unique)

def check_not_err(self, errors, log="Error not expected", expected=None):
if not errors:
return
Expand Down

0 comments on commit 834f2e1

Please sign in to comment.