Skip to content

Commit

Permalink
confest updates with api test fixes and json corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyBatten committed Mar 25, 2024
1 parent ea51ac1 commit a5539a6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 49 deletions.
14 changes: 7 additions & 7 deletions api/tests/opentrons/protocol_engine/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from opentrons_shared_data import load_shared_data
from opentrons_shared_data.deck import load as load_deck
from opentrons_shared_data.deck.dev_types import DeckDefinitionV4
from opentrons_shared_data.deck.dev_types import DeckDefinitionV5
from opentrons_shared_data.labware import load_definition
from opentrons_shared_data.pipette import pipette_definition
from opentrons.protocols.models import LabwareDefinition
Expand Down Expand Up @@ -56,21 +56,21 @@ def ot3_hardware_api(decoy: Decoy) -> OT3API:


@pytest.fixture(scope="session")
def ot2_standard_deck_def() -> DeckDefinitionV4:
def ot2_standard_deck_def() -> DeckDefinitionV5:
"""Get the OT-2 standard deck definition."""
return load_deck(STANDARD_OT2_DECK, 4)
return load_deck(STANDARD_OT2_DECK, 5)


@pytest.fixture(scope="session")
def ot2_short_trash_deck_def() -> DeckDefinitionV4:
def ot2_short_trash_deck_def() -> DeckDefinitionV5:
"""Get the OT-2 short-trash deck definition."""
return load_deck(SHORT_TRASH_DECK, 4)
return load_deck(SHORT_TRASH_DECK, 5)


@pytest.fixture(scope="session")
def ot3_standard_deck_def() -> DeckDefinitionV4:
def ot3_standard_deck_def() -> DeckDefinitionV5:
"""Get the OT-2 standard deck definition."""
return load_deck(STANDARD_OT3_DECK, 4)
return load_deck(STANDARD_OT3_DECK, 5)


@pytest.fixture(scope="session")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
FixtureDoesNotExistError,
CutoutDoesNotExistError,
AddressableAreaDoesNotExistError,
FixtureDoesNotProvideAreasError,
)
from opentrons.protocol_engine.types import (
AddressableArea,
Expand Down Expand Up @@ -158,16 +157,6 @@ def test_get_provided_addressable_area_names(
assert provided_addressable_areas == expected_areas


def test_get_provided_addressable_area_raises(
ot3_standard_deck_def: DeckDefinitionV5,
) -> None:
"""It should raise if the cutout fixture does not provide areas for the given cutout id."""
with pytest.raises(FixtureDoesNotProvideAreasError):
subject.get_provided_addressable_area_names(
"singleRightSlot", "theFunCutout", ot3_standard_deck_def
)


@pytest.mark.parametrize(
(
"addressable_area_name",
Expand Down Expand Up @@ -288,11 +277,7 @@ def test_get_potential_cutout_fixtures_raises(
display_name="Slot D1",
bounding_box=Dimensions(x=128.0, y=86.0, z=0),
position=AddressableOffsetVector(x=1, y=2, z=3),
compatible_module_types=[
"temperatureModuleType",
"heaterShakerModuleType",
"magneticBlockType",
],
compatible_module_types=[],
),
lazy_fixture("ot3_standard_deck_def"),
),
Expand Down
45 changes: 21 additions & 24 deletions api/tests/opentrons/protocol_engine/state/test_module_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ def get_addressable_area_view(

def test_initial_state() -> None:
"""It should initialize the module state."""
addressable_area_view = get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
)

subject = ModuleStore(
config=_OT2_STANDARD_CONFIG,
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)

assert subject.state == ModuleState(
Expand All @@ -99,10 +101,7 @@ def test_initial_state() -> None:
substate_by_module_id={},
module_offset_by_serial={},
additional_slots_occupied_by_module_id={},
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)


Expand Down Expand Up @@ -201,12 +200,14 @@ def test_load_module(
),
)

addressable_area_view = get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
)

subject = ModuleStore(
config=_OT2_STANDARD_CONFIG,
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)
subject.handle_action(action)

Expand All @@ -223,10 +224,7 @@ def test_load_module(
substate_by_module_id={"module-id": expected_substate},
module_offset_by_serial={},
additional_slots_occupied_by_module_id={},
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)


Expand Down Expand Up @@ -359,12 +357,14 @@ def test_add_module_action(
module_live_data=live_data,
)

addressable_area_view = get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
)

subject = ModuleStore(
config=_OT2_STANDARD_CONFIG,
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)
subject.handle_action(action)

Expand All @@ -381,10 +381,7 @@ def test_add_module_action(
substate_by_module_id={"module-id": expected_substate},
module_offset_by_serial={},
additional_slots_occupied_by_module_id={},
addressable_area_view=get_addressable_area_view(
deck_configuration=None,
use_simulated_deck_config=True,
),
addressable_area_view=addressable_area_view,
)


Expand Down
5 changes: 4 additions & 1 deletion shared-data/command/schemas/8.json
Original file line number Diff line number Diff line change
Expand Up @@ -1494,9 +1494,12 @@
"location": {
"title": "Location",
"description": "The location into which this module should be loaded.\n\nFor the Thermocycler Module, which occupies multiple deck slots, this should be the front-most occupied slot (normally slot 7).",
"allOf": [
"anyOf": [
{
"$ref": "#/definitions/DeckSlotLocation"
},
{
"$ref": "#/definitions/AddressableAreaLocation"
}
]
},
Expand Down
8 changes: 7 additions & 1 deletion shared-data/python/tests/deck/test_typechecks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
list_names as list_deck_definition_names,
load as load_deck_definition,
)
from opentrons_shared_data.deck.dev_types import DeckDefinitionV3, DeckDefinitionV4
from opentrons_shared_data.deck.dev_types import DeckDefinitionV3, DeckDefinitionV4, DeckDefinitionV5


@pytest.mark.parametrize("defname", list_deck_definition_names(version=3))
Expand All @@ -18,3 +18,9 @@ def test_v3_defs(defname):
def test_v4_defs(defname):
defn = load_deck_definition(name=defname, version=4)
typeguard.check_type(defn, DeckDefinitionV4)


@pytest.mark.parametrize("defname", list_deck_definition_names(version=5))
def test_v5_defs(defname):
defn = load_deck_definition(name=defname, version=5)
typeguard.check_type(defn, DeckDefinitionV5)

0 comments on commit a5539a6

Please sign in to comment.