test(step-generation): test to compare PD JSON protocols vs Python export #18236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This test compares the JSON commands that PD generates to the engine commands produced by PD Python export.
When we launch Python export, we want to be able to guarantee that if users run the Python file instead of the JSON file, the protocol will do the same thing.
This test takes pairs of JSON and Python protocols from the
__pd_protocols__/
directory. It executes the Python protocol to see what engine commands it calls. We then compare those engine commands to the commands in the JSON protocol. If PD Python export is working correctly, the commands should match exactly (after some cleanup that this test performs).This PR includes 2 test protocols for now:
simple_transfer.json
and.py
: A simple protocol with a single Transfer step. This confirms that the Python code we generate produces exactly the same engine commands as JSON step generation. (I selected the mix option for this transfer, so this test also exercises the new Pythonmix()
options we just implemented this week.)demo_day.json
and.py
: The was the protocol we showed for Demo Day. This test exercises the commands for controlling the various modules.Future test plans
I'd like to build a comprehensive test suite that exercises every option in PD (or at least the ones we care about). The plan would be: make a protocol in PD, export it as JSON, also export it as Python, save both files into
__pd_protocols__/
, then run this test to confirm that Python and JSON do the same thing. Maybe we could get help from QA for this? (@alexjoel42)For now we'd have to do this manually, and update the files every time step generation changes. In the future, we could maybe rig up something to regenerate the JSON and Python protocols whenever we change step generation.
We can also use this test to see if the upcoming PD liquid class implementation is doing the right thing. Hypothetically, if you create liquid class transfer in PD (liquid class ethanol, volume 99 uL, tip pickup per source), and don't change any of the options, PD should generate JSON commands exactly equivalent to the engine commands from:
which is the Python protocol in
hypothetical_lc_transfer.py
.PD's step generation doesn't do that right now, so we have our work cut out for us. But we can use this test to see what we're missing in PD. (@ncdiehl)
Risk assessment
Low, test only.