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

test(app-testing): full phase 1 app analysis battery #12143

Merged
merged 11 commits into from
Feb 16, 2023
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
Prev Previous commit
Next Next commit
working
  • Loading branch information
y3rsh committed Jan 27, 2023
commit 210febe042108fbcfb4c60ad3d6e77492b3b2684
4 changes: 4 additions & 0 deletions app-testing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ teardown:
.PHONY: format-readme
format-readme:
yarn prettier --write README.md

.PHONY: print-protocols
print-protocols:
pipenv run python print_protocols.py
2 changes: 1 addition & 1 deletion app-testing/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ atomicwrites = "==1.4.1"
pyreadline3 = "==3.4.1"
pydantic = "==1.10.4"
pygithub = "==1.57"
ruff = "==0.0.211"
ruff = "==0.0.236"

[requires]
python_version = "3.11"
61 changes: 31 additions & 30 deletions app-testing/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions app-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,15 @@ make remove file_path=$MONOREPOPATH/app-testing/ci-tools/ot2_with_all_modules.ya

- Only have 1 robot connected at once.
- Build locators like you have more than 1 to future proof.

## Analysis Test

The analysis test `pipenv run pytest -k test_analyses` is driven by the comma delimited string variable `APP_ANALYSIS_TEST_PROTOCOLS` in `.env`
This allows us to run one or many.

### Adding protocols

1. add the protocol file named according to the naming convention in the files/protocols appropriate folder
1. add the protocol stem to `protocol_files.py`
1. add the protocol data as a property to `protocols.py`
1. run `make print-protocols`
30 changes: 20 additions & 10 deletions app-testing/automation/data/protocol_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,27 @@
from typing import Literal

names = Literal[
"OT2_P1000SLeft_None_6_1_SimpleTransfer",
"OT2_P20SRight_None_6_1_SimpleTransferError",
"OT2_P20S_P300M_HS_6_1_HS_WithCollision_Error",
"OT2_P20S_P300M_NoMods_6_1_TransferReTransferLiquid",
"OT2_P300M_P20S_HS_6_1_Smoke620release",
"OT2_P300M_P20S_MM_HS_TD_TC_6_1_AllMods_Error",
"OT2_P300M_P20S_MM_TM_TC1_5_2_6_PD40",
"OT2_P300M_P20S_MM_TM_TC1_5_2_6_PD40Error",
"OT2_P300M_P20S_NoMod_6_1_MixTransferManyLiquids",
"OT2_P300M_P300S_HS_6_1_HS_NormalUseWithTransfer",
"OT2_P300SG1_None_5_2_6_Gen1PipetteSimple",
"OT2_P300SLeft_MM_TM_TM_5_2_6_MOAMTemps",
"OT2_None_None_2_12_Python310SyntaxRobotAnalysisOnlyError",
"OT2_None_None_2_13_PythonSyntaxError",
"OT2_P10S_P300M_TC1_TM_MM_2_11_Swift",
"OT2_P20S_None_2_7_Walkthrough",
"OT2_Python_Syntax_Error",
"OT2_P10S_P300M_All_Modules_Swift",
"OT2_P300M_Mag_Temp_Zymo",
"OT2_P300MLeft_MM_TM_2_4_Zymo",
"OT2_P300M_P20S_None_2_12_FailOnRun",
"OT2_P300M_P20S_TC_MM_TM_6_13_Smoke620Release",
"OT2_P300SLeft_MM1_MM_2_2_EngageMagHeightFromBase",
"OT2_P300SLeft_MM1_MM_TM_2_3_Mix",
"OT2_P300S_Thermocycler_Moam_Error",
"OT2_P300S_Twinning_Error",
"OT2_S20_M300_NoMods_6_1_TransferReTransferLiquid",
"OT2_P300M_P20S_MM_HS_TD_TC_6_1_AllMods_Error",
"OT2_P20S_P300M_NoMod_6_1_MixTransferManyLiquids",
"OT2_P20S_P300M_HS_6_1_HS_NormalUseWithTransfer",
"OT2_P20S_P300M_HS_6_1_HS_WithCollision_Error",
"OT2_API_level_2_3",
"OT2_API_level_2_2",
]
38 changes: 19 additions & 19 deletions app-testing/automation/data/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Protocols:
robot_error=False,
)

OT2_Python_Syntax_Error: Protocol = Protocol(
file_name="OT2_Python_Syntax_Error",
OT2_None_None_2_13_PythonSyntaxError: Protocol = Protocol(
file_name="OT2_None_None_2_13_PythonSyntaxError",
file_extension="py",
protocol_name="bad import",
robot="OT-2",
Expand All @@ -28,17 +28,17 @@ class Protocols:
robot_analysis_error="?",
)

OT2_P10S_P300M_All_Modules_Swift: Protocol = Protocol(
file_name="OT2_P10S_P300M_All_Modules_Swift",
OT2_P10S_P300M_TC1_TM_MM_2_11_Swift: Protocol = Protocol(
file_name="OT2_P10S_P300M_TC1_TM_MM_2_11_Swift",
file_extension="py",
protocol_name="OT2_P10S_P300M_All_Modules_Swift.py",
protocol_name="OT2_P10S_P300M_TC1_TM_MM_2_11_Swift.py",
robot="OT-2",
app_error=False,
robot_error=False,
)

OT2_P300M_Mag_Temp_Zymo: Protocol = Protocol(
file_name="OT2_P300M_Mag_Temp_Zymo",
OT2_P300MLeft_MM_TM_2_4_Zymo: Protocol = Protocol(
file_name="OT2_P300MLeft_MM_TM_2_4_Zymo",
file_extension="py",
protocol_name="Zymo Direct-zol96 Magbead RNA",
robot="OT-2",
Expand Down Expand Up @@ -68,8 +68,8 @@ class Protocols:
robot_analysis_error="?",
)

OT2_S20_M300_NoMods_6_1_TransferReTransferLiquid: Protocol = Protocol(
file_name="OT2_S20_M300_NoMods_6_1_TransferReTransferLiquid",
OT2_P20S_P300M_NoMods_6_1_TransferReTransferLiquid: Protocol = Protocol(
file_name="OT2_P20S_P300M_NoMods_6_1_TransferReTransferLiquid",
file_extension="json",
protocol_name="Transfer- Multi liquid (retransfer)",
robot="OT-2",
Expand All @@ -88,17 +88,17 @@ class Protocols:
robot_analysis_error="?",
)

OT2_P20S_P300M_NoMod_6_1_MixTransferManyLiquids: Protocol = Protocol(
file_name="OT2_P20S_P300M_NoMod_6_1_MixTransferManyLiquids",
OT2_P300M_P20S_NoMod_6_1_MixTransferManyLiquids: Protocol = Protocol(
file_name="OT2_P300M_P20S_NoMod_6_1_MixTransferManyLiquids",
file_extension="json",
protocol_name="Mix/transfer- several liquids",
robot="OT-2",
app_error=False,
robot_error=False,
)

OT2_P20S_P300M_HS_6_1_HS_NormalUseWithTransfer: Protocol = Protocol(
file_name="OT2_P20S_P300M_HS_6_1_HS_NormalUseWithTransfer",
OT2_P300M_P300S_HS_6_1_HS_NormalUseWithTransfer: Protocol = Protocol(
file_name="OT2_P300M_P300S_HS_6_1_HS_NormalUseWithTransfer",
file_extension="json",
protocol_name="H/S normal use",
robot="OT-2",
Expand All @@ -124,19 +124,19 @@ class Protocols:
""",
)

OT2_API_level_2_3: Protocol = Protocol(
file_name="OT2_API_level_2_3",
OT2_P300SLeft_MM1_MM_TM_2_3_Mix: Protocol = Protocol(
file_name="OT2_P300SLeft_MM1_MM_TM_2_3_Mix",
file_extension="py",
protocol_name="OT2_API_level_2_3.py",
protocol_name="OT2_P300SLeft_MM1_MM_TM_2_3_Mix.py",
robot="OT-2",
app_error=False,
robot_error=False,
)

OT2_API_level_2_2: Protocol = Protocol(
file_name="OT2_API_level_2_2",
OT2_P300SLeft_MM1_MM_2_2_EngageMagHeightFromBase: Protocol = Protocol(
file_name="OT2_P300SLeft_MM1_MM_2_2_EngageMagHeightFromBase",
file_extension="py",
protocol_name="OT2_API_level_2_2.py",
protocol_name="OT2_P300SLeft_MM1_MM_2_2_EngageMagHeightFromBase.py",
robot="OT-2",
app_error=False,
robot_error=False,
Expand Down
5 changes: 3 additions & 2 deletions app-testing/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ UPDATE_CHANNEL="beta" # latest beta alpha
LOCALHOST=false
# run all tests
# possible values in \automation\data\protocol_files.py
#APP_ANALYSIS_TEST_PROTOCOLS="OT2_P20S_None_2_7_Walkthrough , OT2_Python_Syntax_Error, OT2_P10S_P300M_All_Modules_Swift, OT2_P300M_Mag_Temp_Zymo, OT2_P300S_Thermocycler_Moam_Error, OT2_P300S_Twinning_Error, OT2_S20_M300_NoMods_6_1_TransferReTransferLiquid, OT2_P300M_P20S_MM_HS_TD_TC_6_1_AllMods_Error, OT2_P20S_P300M_NoMod_6_1_MixTransferManyLiquids, OT2_P20S_P300M_HS_6_1_HS_NormalUseWithTransfer, OT2_P20S_P300M_HS_6_1_HS_WithCollision_Error, OT2_API_level_2_3, OT2_API_level_2_2"
# dynamically generate with make print-protocols
#APP_ANALYSIS_TEST_PROTOCOLS="OT2_P1000SLeft_None_6_1_SimpleTransfer, OT2_P20SRight_None_6_1_SimpleTransferError, OT2_P20S_P300M_HS_6_1_HS_WithCollision_Error, OT2_P20S_P300M_NoMods_6_1_TransferReTransferLiquid, OT2_P300M_P20S_HS_6_1_Smoke620release, OT2_P300M_P20S_MM_HS_TD_TC_6_1_AllMods_Error, OT2_P300M_P20S_MM_TM_TC1_5_2_6_PD40, OT2_P300M_P20S_MM_TM_TC1_5_2_6_PD40Error, OT2_P300M_P20S_NoMod_6_1_MixTransferManyLiquids, OT2_P300M_P300S_HS_6_1_HS_NormalUseWithTransfer, OT2_P300SG1_None_5_2_6_Gen1PipetteSimple, OT2_P300SLeft_MM_TM_TM_5_2_6_MOAMTemps, OT2_None_None_2_12_Python310SyntaxRobotAnalysisOnlyError, OT2_None_None_2_13_PythonSyntaxError, OT2_P10S_P300M_TC1_TM_MM_2_11_Swift, OT2_P20S_None_2_7_Walkthrough, OT2_P300MLeft_MM_TM_2_4_Zymo, OT2_P300M_P20S_None_2_12_FailOnRun, OT2_P300M_P20S_TC_MM_TM_6_13_Smoke620Release, OT2_P300SLeft_MM1_MM_2_2_EngageMagHeightFromBase, OT2_P300SLeft_MM1_MM_TM_2_3_Mix, OT2_P300S_Thermocycler_Moam_Error, OT2_P300S_Twinning_Error"
# run one
APP_ANALYSIS_TEST_PROTOCOLS="OT2_API_level_2_2"
APP_ANALYSIS_TEST_PROTOCOLS="OT2_P1000SLeft_None_6_1_SimpleTransfer"
FILES_FOLDER="files"
26 changes: 26 additions & 0 deletions app-testing/print_protocols.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# pipenv run python print_protocols.py
import pathlib

import rich
from automation.data.protocols import Protocols
from rich.panel import Panel

stems = [p.stem for p in pathlib.Path(pathlib.Path.cwd(), "files", "protocols").rglob("*") if p.is_file()]
rich.print(Panel("For protocol_files.names"))
rich.print(stems)
rich.print(Panel("Formatted for .env"))
rich.print(", ".join(stems))
rich.print(Panel("What are actually defined?"))
protocols = Protocols()
props = [prop for prop in dir(protocols) if "__" not in prop]
rich.print(", ".join(props))

possible = set(stems)
actual = set(props)
out = possible - actual
rich.print(Panel("Are all protocols mapped?"))
if len(out) == 0:
rich.print("🥳everything is mapped.")
else:
rich.print("The below protocols need mapped:")
rich.print(out)