test(api): fix or ignore Decoy related warnings in unit tests #16944
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR aims to reduce the amount of warnings generated by the API unit tests by fixing or selectively ignoring specific Decoy warnings.
Across the entire test suite,
MissingSpecAttributeWarning
has been suppressed. The purpose of this is to catch non-existent attributes of decoy mock objects, but it's being raised for any property that is referenced, which accounts for about 250 warnings. Ignoring these should not cause any issues because if a property is not being referred to properly, the vast majority of the time that will cause the test to fail anyway due to some rehearsal not occurring.The other warning being suppressed is
RedundantVerifyWarning
forprotocol_runner.py: test_load_json_runner
, which cannot be fixed without harming the coverage of the test. Because there is a long explanation of why it is needed, I've chosen to simply ignore that for this specific test.Otherwise I've fixed up a bunch of
IncorrectCallWarning
,RedundantVerifyWarning
andMiscalledStubWarning
throughout the unit tests.There are still a few existing
DeprecationWarning
s and a bunch ofRuntimeWarning
s related toCanMessenger._read_task_shield' was never awaited
but fixing those would involve more effort or changing packages/editing hardware code, so those have not been fixed.Overall this reduces the amount of warnings from ~330 to ~40 warnings.
Changelog
Review requests
If anybody has an easy fix for any remaining errors, feel free to push it to this branch.
Risk assessment
Low