Skip to content

Commit

Permalink
SyncClient.load_pipette does not need pipette_id argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
amit lissack committed May 4, 2021
1 parent cdc22c1 commit 15c0570
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def load_pipette( # noqa: D102
result = self._engine_client.load_pipette(
pipette_name=PipetteName(pipette_name),
mount=Mount(mount),
pipette_id=None,
)

return PipetteContext(
Expand Down
4 changes: 1 addition & 3 deletions api/src/opentrons/protocol_engine/clients/sync_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Synchronous ProtocolEngine client module."""
from uuid import uuid4
from typing import cast, Optional
from typing import cast

from opentrons.types import MountType

Expand Down Expand Up @@ -51,13 +51,11 @@ def load_pipette(
self,
pipette_name: PipetteName,
mount: MountType,
pipette_id: Optional[str],
) -> commands.LoadPipetteResult:
"""Execute a LoadPipetteRequest and return the result."""
request = commands.LoadPipetteRequest(
pipetteName=pipette_name,
mount=mount,
pipetteId=pipette_id
)
result = self._transport.execute_command(
request=request,
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/commands/load_pipette.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LoadPipetteRequest(BaseModel):
description="The mount the pipette should be present on.",
)
pipetteId: Optional[str] = Field(
...,
None,
description="An optional ID to assign to this pipette. If None, an ID "
"will be generated."
)
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/execution/equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def load_pipette(
except RuntimeError as e:
raise FailedToLoadPipetteError(str(e)) from e

pipette_id = pipette_id if pipette_id else \
pipette_id = pipette_id if pipette_id is not None else \
self._resources.id_generator.generate_id()

return LoadedPipette(pipette_id=pipette_id)
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def test_load_pipette(
engine_client.load_pipette(
pipette_name=PipetteName.P300_SINGLE,
mount=Mount.LEFT,
pipette_id=None,
)
).then_return(commands.LoadPipetteResult(pipetteId="pipette-id"))

Expand All @@ -72,15 +71,13 @@ def test_load_instrument(
engine_client.load_pipette(
pipette_name=PipetteName.P300_MULTI,
mount=Mount.LEFT,
pipette_id=None
)
).then_return(commands.LoadPipetteResult(pipetteId="left-pipette-id"))

decoy.when(
engine_client.load_pipette(
pipette_name=PipetteName.P300_SINGLE,
mount=Mount.RIGHT,
pipette_id=None
)
).then_return(commands.LoadPipetteResult(pipetteId="right-pipette-id"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def test_load_pipette(
request = commands.LoadPipetteRequest(
pipetteName=PipetteName.P300_SINGLE,
mount=MountType.RIGHT,
pipetteId=None,
)

expected_result = commands.LoadPipetteResult(pipetteId="abc123")
Expand All @@ -104,7 +103,6 @@ def test_load_pipette(
result = subject.load_pipette(
pipette_name=PipetteName.P300_SINGLE,
mount=MountType.RIGHT,
pipette_id=None,
)

assert result == expected_result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_load_pipette_request() -> None:
request = LoadPipetteRequest(
pipetteName=PipetteName.P300_SINGLE,
mount=MountType.LEFT,
pipetteId=None
)

assert request.pipetteName == "p300_single"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def load_pipette_command(now: datetime) -> CompletedLoadLabware:
request=cmd.LoadPipetteRequest(
pipetteName=PipetteName.P300_SINGLE,
mount=MountType.LEFT,
pipetteId=None,
),
result=cmd.LoadPipetteResult(pipetteId="pipette-id"),
created_at=now,
Expand Down
2 changes: 0 additions & 2 deletions robot-server/tests/service/session/models/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_not_empty():
assert request.data.data == pe_commands.LoadPipetteRequest(
pipetteName="p10_single",
mount=MountType.LEFT,
pipetteId=None,
)

dt = datetime(2000, 1, 1)
Expand All @@ -84,7 +83,6 @@ def test_not_empty():
assert response.data == pe_commands.LoadPipetteRequest(
pipetteName="p10_single",
mount=MountType.LEFT,
pipetteId=None,
)
assert response.id == "id"
assert response.createdAt == dt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ async def test_load_instrument(command_executor, mock_protocol_engine):
request_body = pe_commands.LoadPipetteRequest(
pipetteName="p10_single",
mount=MountType.LEFT,
pipetteId=None,
)

protocol_engine_response = pe_commands.CompletedCommand(
Expand Down

0 comments on commit 15c0570

Please sign in to comment.