Opentrons / opentrons

Software for writing protocols and running them on the Opentrons Flex and Opentrons OT-2
https://opentrons.com
Apache License 2.0
429 stars 179 forks source link

test(api): fix or ignore Decoy related warnings in unit tests #16944

Closed jbleon95 closed 1 week ago

jbleon95 commented 1 week ago

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 for protocol_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 and MiscalledStubWarning throughout the unit tests.

There are still a few existing DeprecationWarnings and a bunch of RuntimeWarnings related to CanMessenger._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