Skip to content

Commit

Permalink
fix(api): Implicitly pre-home in opentrons.simulate.get_protocol_api() (
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring authored Oct 16, 2023
1 parent 9cdeaf4 commit 4b78142
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/src/opentrons/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ def get_protocol_api(
extra_labware=extra_labware,
)

# Intentional difference from execute.get_protocol_api():
# For the caller's convenience, we home the virtual hardware so they don't get MustHomeErrors.
# Since this hardware is virtual, there's no harm in commanding this "movement" implicitly.
context.home()

return context


Expand Down
11 changes: 11 additions & 0 deletions api/tests/opentrons/test_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,17 @@ def test_jupyter_not_on_filesystem(
simulate.simulate(protocol_file=protocol_filelike, file_name=file_name)


def test_get_protocol_api_usable_without_homing(api_version: APIVersion) -> None:
"""You should be able to move the simulated hardware without having to home explicitly.
https://opentrons.atlassian.net/browse/RQA-1801
"""
protocol = simulate.get_protocol_api(api_version)
pipette = protocol.load_instrument("p300_single_gen2", mount="left")
tip_rack = protocol.load_labware("opentrons_96_tiprack_300ul", 1)
pipette.pick_up_tip(tip_rack["A1"]) # Should not raise.


class TestGetProtocolAPILabware:
"""Tests for making sure get_protocol_api() handles extra labware correctly."""

Expand Down

0 comments on commit 4b78142

Please sign in to comment.