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

Accessing results.by_state creates empty list and corrupts results.most_significant_state #47

Open
joni1993 opened this issue Apr 25, 2022 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@joni1993
Copy link

If you access your results with by_state it creates and empty list entry for the accessed value.

Example:
I use len(results.by_state[np.Critical]) > 0: in Summary.problem to print Critical first followed by Warnings. This though creates an empty record for Critical in my tests (where no critical results exist only warning)- making them fail:

pprint((check.results.most_significant_state))
pprint((check.results.most_significant))

Result:

Critical(code=2, text='critical')
[]

This results in the whole check return CRITICAL, despite having no results that are actually critical (only warnings are present). The issue is most likely due to self.by_state = collections.defaultdict(list)

Workaround:
Don't use results.by_state if you are not sure it contains elements, use results.most_significant_state == np.Critical instead. Still this seems rather critical problem to me.

@mpounsett mpounsett self-assigned this May 17, 2022
@mpounsett mpounsett added the bug Something isn't working label May 17, 2022
@mpounsett mpounsett added this to the 1.3.3 milestone May 17, 2022
@mpounsett
Copy link
Owner

I'll check that out on my next pass of fixes and updates. Thanks for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants