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

feat(thermocycler-gen2): update hardware controller #11490

Merged
merged 3 commits into from
Oct 27, 2022

Conversation

pmoegenburg
Copy link
Member

Updates hardware controller to use AsyncResponseSerialConnection

@pmoegenburg pmoegenburg self-assigned this Sep 22, 2022
@pmoegenburg pmoegenburg requested a review from a team as a code owner September 22, 2022 02:33
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #11490 (2718b6b) into release_6.1.0 (ce4d01b) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                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              
Flag Coverage Δ
notify-server 88.26% <ø> (-0.92%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
api/src/opentrons/drivers/thermocycler/driver.py 94.11% <100.00%> (ø)
notify-server/notify_server/settings.py
notify-server/notify_server/server/__init__.py
notify-server/notify_server/__init__.py
notify-server/notify_server/logging.py

usb_port: USBPort,
) -> AsyncGenerator[modules.Thermocycler, None]:
"""Test subject with mocked driver"""
driver_mock = mock.AsyncMock()
Copy link
Contributor

@mcous mcous Sep 22, 2022

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]:
    ...

Comment on lines 269 to 278
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
Copy link
Contributor

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 = (
Copy link
Contributor

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 = ( ... )

@pmoegenburg pmoegenburg requested review from a team as code owners September 26, 2022 22:16
@pmoegenburg pmoegenburg requested review from koji and removed request for a team September 26, 2022 22:16
@pmoegenburg pmoegenburg changed the base branch from edge to release_6.1.0 September 26, 2022 22:20
@sanni-t
Copy link
Member

sanni-t commented Sep 27, 2022

I think you want to target this to edge

@pmoegenburg pmoegenburg changed the base branch from release_6.1.0 to develop-6.3.0 October 6, 2022 17:18
@sfoster1
Copy link
Member

I think you want to target this to edge

No, unfortunately we're continuing to try and develop the TCGEN2 release independent of edge

@sfoster1
Copy link
Member

Okay, we should target this on edge and once merged we'll cherry-pick to #11607

@sfoster1
Copy link
Member

Or we can target it on #11607 and it'll come back in when we merge that back

@sfoster1 sfoster1 changed the base branch from develop-6.3.0 to edge October 24, 2022 20:17
@sfoster1
Copy link
Member

Retargeting to edge since everything else for TCGEN2 is in there, and we're cherrypicking anyway.

Copy link
Contributor

@mcous mcous left a 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

@sfoster1 sfoster1 changed the base branch from edge to develop_6.2.0 October 27, 2022 15:28
@sfoster1 sfoster1 merged commit 28a0822 into develop_6.2.0 Oct 27, 2022
@sfoster1 sfoster1 deleted the TC2_TD3_fix_async_error_reading branch October 27, 2022 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants