-
Notifications
You must be signed in to change notification settings - Fork 175
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
feat(thermocycler-gen2): update hardware controller #11490
Conversation
Codecov Report
@@ Coverage Diff @@
## release_6.1.0 #11490 +/- ##
=================================================
- Coverage 74.46% 74.45% -0.02%
=================================================
Files 2033 2029 -4
Lines 56565 56530 -35
Branches 5534 5534
=================================================
- Hits 42120 42087 -33
+ Misses 13210 13208 -2
Partials 1235 1235
Flags with carried forward coverage won't be shown. Click here to find out more. |
usb_port: USBPort, | ||
) -> AsyncGenerator[modules.Thermocycler, None]: | ||
"""Test subject with mocked driver""" | ||
driver_mock = mock.AsyncMock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mock_driver
should be a separate fixture that's injected into this fixture
@pytest.fixture
def mock_driver() -> mock.AsyncMock:
return mock.AsyncMock(spec=DRIVER_CLASS_HERE)
@pytest.fixture
async def subject_mocked_driver(
usb_port: USBPort,
mock_driver: mock.AsyncMock,
) -> AsyncGenerator[modules.Thermocycler, None]:
...
async def fake_get_plate_temperature(*args, **kwargs): | ||
return PlateTemperature(current=50, target=50) | ||
|
||
|
||
async def fake_get_lid_temperature(*args, **kwargs): | ||
return Temperature(current=50, target=50) | ||
|
||
|
||
async def fake_get_lid_status(*args, **kwargs): | ||
return ThermocyclerLidStatus.OPEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These one-line functions to return one-line value objects make these tests harder for me to read. Could the values objects be used directly, instead?
mock_get_lid_status, | ||
): | ||
"""Test that poll after synchronous temperature response with error updates module live data and status.""" | ||
subject_mocked_driver._driver.get_plate_temperature.return_value = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One should never mock out implementation details of a test subject like this. This test should not know that modules.Thermocycler
has a private _driver
attribute.
Instead, set the mocks on the driver you're injecting (see comment above about creating a mock_driver
fixture):
async def test_sync_error_response_to_poller(
mock_driver: mock.AsyncMock,
subject_mocked_driver: modules.Thermocycler,
...,
):
...
mock_driver.get_plate_temperature.return_value = ( ... )
058fbc5
to
b66dad3
Compare
I think you want to target this to |
No, unfortunately we're continuing to try and develop the TCGEN2 release independent of edge |
Okay, we should target this on edge and once merged we'll cherry-pick to #11607 |
Or we can target it on #11607 and it'll come back in when we merge that back |
Retargeting to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the test changes, LGTM
Updates hardware controller to use AsyncResponseSerialConnection