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

fix(api): disallow hashing we using a fixit command #15026

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def hash_protocol_command_params(
The command hash, if the command is a protocol command.
`None` if the command is a setup command.
"""
if create.intent == CommandIntent.SETUP:
if create.intent in [CommandIntent.SETUP, CommandIntent.FIXIT]:
return None
# We avoid Python's built-in hash() function because it's not stable across
# runs of the Python interpreter. (Jira RSS-215.)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for hash_command_params."""
import pytest

from opentrons.protocol_engine import CommandIntent
from opentrons.protocol_engine import commands
Expand Down Expand Up @@ -66,10 +67,11 @@ def test_repeated_commands() -> None:
assert a_hash != b_hash


def test_setup_command() -> None:
@pytest.mark.parametrize("command_intent", [CommandIntent.SETUP, CommandIntent.FIXIT])
def test_setup_command(command_intent: CommandIntent) -> None:
"""Setup commands should always hash to None."""
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
setup_command = commands.WaitForDurationCreate(
params=commands.WaitForDurationParams(seconds=123),
intent=CommandIntent.SETUP,
intent=command_intent,
)
assert hash_protocol_command_params(setup_command, None) is None
Loading