Skip to content

Commit

Permalink
fix(hardware-testing): remove gravimetric patches (#14152)
Browse files Browse the repository at this point in the history
* override the pipette guards at runtime instead of with a patch

* remove the api patch for gravimetric tests

* format/lint
  • Loading branch information
ryanthecoder committed Jan 3, 2024
1 parent f1721f1 commit e666bad
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 33 deletions.
31 changes: 26 additions & 5 deletions hardware-testing/hardware_testing/gravimetric/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,30 @@ def _check_if_software_supports_high_volumes() -> bool:
return modified_a and modified_b


def _override_set_current_volume(self, new_volume: float) -> None: # noqa: ANN001
assert new_volume >= 0
# assert new_volume <= self.working_volume
self._current_volume = new_volume


def _override_add_current_volume(self, volume_incr: float) -> None: # noqa: ANN001
self._current_volume += volume_incr


def _override_ok_to_add_volume(self, volume_incr: float) -> bool: # noqa: ANN001
return True


def _override_software_supports_high_volumes() -> None:
# yea so ok this is pretty ugly but this is super helpful for us
# with this we don't need to apply patches, and can run the testing scripts
# without pushing modified code to the robot

Pipette.set_current_volume = _override_set_current_volume # type: ignore[assignment]
Pipette.ok_to_add_volume = _override_ok_to_add_volume # type: ignore[assignment]
Pipette.add_current_volume = _override_add_current_volume # type: ignore[assignment]


def _get_channel_offset(cfg: config.VolumetricConfig, channel: int) -> Point:
assert (
channel < cfg.pipette_channels
Expand Down Expand Up @@ -327,11 +351,8 @@ def _get_volumes(
kind, channels, pipette_volume, tip_volume, extra
)
if not _check_if_software_supports_high_volumes():
if ctx.is_simulating():
test_volumes = _reduce_volumes_to_not_exceed_software_limit(
test_volumes, pipette_volume, channels, tip_volume
)
else:
_override_software_supports_high_volumes()
if not _check_if_software_supports_high_volumes():
raise RuntimeError("you are not the correct branch")
return test_volumes

Expand Down
28 changes: 0 additions & 28 deletions hardware-testing/hardware_testing/gravimetric/overrides/api.patch
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
diff --git a/api/src/opentrons/hardware_control/instruments/ot3/pipette.py b/api/src/opentrons/hardware_control/instruments/ot3/pipette.py
index 1f6dd0b4b5..1d0cb7b7e3 100644
--- a/api/src/opentrons/hardware_control/instruments/ot3/pipette.py
+++ b/api/src/opentrons/hardware_control/instruments/ot3/pipette.py
@@ -432,11 +432,11 @@ class Pipette(AbstractInstrument[PipetteConfigurations]):

def set_current_volume(self, new_volume: float) -> None:
assert new_volume >= 0
- assert new_volume <= self.working_volume
+ # assert new_volume <= self.working_volume
self._current_volume = new_volume

def add_current_volume(self, volume_incr: float) -> None:
- assert self.ok_to_add_volume(volume_incr)
+ # assert self.ok_to_add_volume(volume_incr)
self._current_volume += volume_incr

def remove_current_volume(self, volume_incr: float) -> None:
@@ -444,7 +444,8 @@ class Pipette(AbstractInstrument[PipetteConfigurations]):
self._current_volume -= volume_incr

def ok_to_add_volume(self, volume_incr: float) -> bool:
- return self.current_volume + volume_incr <= self.working_volume
+ # return self.current_volume + volume_incr <= self.working_volume
+ return True

def ok_to_push_out(self, push_out_dist_mm: float) -> bool:
return push_out_dist_mm <= (

0 comments on commit e666bad

Please sign in to comment.