Repository navigation
Expose protocol operations and make the test suite portable #42
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
Changes from all commits
5b2e10d
bd9d672
83d54ae
f64984b
b3cd54c
4dcafd8
50238a1
cb4d96e
5b9bca4
4c2242e
f0ac2e4
cfc0357
68be881
a851478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| tests/fixtures/surface/pre_flip_init.py.txt text eol=lf |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,8 @@ class QuadCortex41(QuadCortex): | |||||
| passed, 8 skipped, on a Quad Cortex running CorOS 4.1.0 / app firmware | ||||||
| d14e, by tony-xmelon. That is a contributor's report and the maintainer has | ||||||
| not reproduced it, which is what ``Evidence.CONTRIBUTED`` says here. | ||||||
| ``create_local_backup`` has its own dated 4.1.0 capture and is VERIFIED; | ||||||
| ``create_local_backup`` has its own dated 4.1.0 capture. The contributed | ||||||
| device-name round trip also verified ``set_device_name``; both are VERIFIED. | ||||||
| other inherited operations refuse under ``Support.VERIFIED`` and run with | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Splitting the semicolon left this sentence starting lowercase.
Suggested change
|
||||||
| a warning under ``Support.EXPERIMENTAL``. The snapshot is deliberately absent: | ||||||
| binding the 4.0.1 constants would hand a 4.1 user names their unit does not | ||||||
|
|
@@ -42,7 +43,7 @@ class QuadCortex41(QuadCortex): | |||||
|
|
||||||
| MEASURED_ON = ("4.1.0",) | ||||||
| EVIDENCE = Evidence.CONTRIBUTED | ||||||
| VERIFIED = frozenset({"create_local_backup"}) | ||||||
| VERIFIED = frozenset({"create_local_backup", "set_device_name"}) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the one thing I would most like settled, and it is yours to settle. What I wrote about |
||||||
| models = NoSnapshot("coros_4_1_0") | ||||||
| params = NoSnapshot("coros_4_1_0") | ||||||
| options = NoSnapshot("coros_4_1_0") | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Reversible device-name and edit-history checks against a real unit.""" | ||
|
|
||
| import time | ||
|
|
||
| import pytest | ||
|
|
||
| from pyquadcortex import protocol | ||
| SETTLE = 1.0 | ||
|
|
||
|
|
||
| @pytest.mark.verifies("set_device_name") | ||
| def test_device_name_round_trips_and_is_restored(qc): | ||
| identity = qc.version() | ||
| if not identity.HasField("custom_name"): | ||
| pytest.skip("the unit has no device name to restore without inventing one") | ||
| before = identity.custom_name | ||
| probe = "pyquadcortex probe" | ||
| if before == probe: | ||
| probe = "pyquadcortex probe 2" | ||
|
|
||
| def read_name(): | ||
| reply = qc.version() | ||
| assert reply.HasField("custom_name"), ( | ||
| "the Version reply omitted custom_name, so the name cannot be " | ||
| "confirmed or restored") | ||
| return reply.custom_name | ||
|
|
||
| try: | ||
| qc.set_device_name(probe) | ||
| time.sleep(SETTLE) | ||
| assert read_name() == probe | ||
| finally: | ||
| qc.set_device_name(before) | ||
| time.sleep(SETTLE) | ||
|
|
||
| assert read_name() == before | ||
|
|
||
|
|
||
| @pytest.mark.verifies("undo", "redo") | ||
| def test_undo_and_redo_reverse_and_reapply_a_scratch_edit(qc, scratch_preset): | ||
| """Create, edit, and remove a test-owned copy of the loaded preset.""" | ||
| setlist, position, _name = scratch_preset | ||
| before_preset = qc.read_preset(setlist, position, timeout=30.0) | ||
| occupied = protocol.blocks(before_preset) | ||
| if not occupied: | ||
| pytest.skip("the loaded preset has no block whose bypass can be edited") | ||
| target = occupied[0] | ||
| before_scene = int(qc.active_scene()) | ||
| before = protocol.bypass_state(before_preset, target).scenes[before_scene] | ||
|
|
||
| qc.set_bypass(target, not before) | ||
| time.sleep(SETTLE) | ||
| assert protocol.bypass_state( | ||
| qc.read_current_preset(), target | ||
| ).scenes[before_scene] is not before | ||
|
|
||
| qc.undo() | ||
| time.sleep(SETTLE) | ||
| assert protocol.bypass_state( | ||
| qc.read_current_preset(), target | ||
| ).scenes[before_scene] is before | ||
|
|
||
| qc.redo() | ||
| time.sleep(SETTLE) | ||
| assert protocol.bypass_state( | ||
| qc.read_current_preset(), target | ||
| ).scenes[before_scene] is not before |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -30,6 +30,7 @@ | |||||||
|
|
||||||||
| from pyquadcortex.protocol import client, units, values | ||||||||
| from pyquadcortex.protocol.enums import Input | ||||||||
| from pyquadcortex.protocol.proto import ProductionAutomation_pb2 as pa | ||||||||
|
|
||||||||
| SETTLE = 2.0 | ||||||||
|
|
||||||||
|
|
@@ -38,6 +39,22 @@ | |||||||
| PORT = Input.INPUT_1 | ||||||||
|
|
||||||||
|
|
||||||||
| @pytest.mark.verifies("inhibited_modules") | ||||||||
| def test_inhibited_modules_is_a_complete_read_only_snapshot(qc): | ||||||||
| """Both false fields were explicitly present on CorOS 4.1.0 / d14e. | ||||||||
|
|
||||||||
| Presence matters here: protobuf also returns false when an optional field was | ||||||||
| never sent, and reporting that default as device state would be a guess. | ||||||||
| """ | ||||||||
| # Read twice because a first state READ can be dropped; both successful | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| # replies must carry explicit fields rather than protobuf defaults. | ||||||||
| for _ in range(2): | ||||||||
| state = qc.inhibited_modules() | ||||||||
| assert state.action == pa.MessageAction.UPDATE | ||||||||
| assert state.HasField("global_gate") | ||||||||
| assert state.HasField("global_eq") | ||||||||
|
|
||||||||
|
|
||||||||
| def _input_level(qc, port_id): | ||||||||
| for port in qc.io_settings().settings.in_port: | ||||||||
| if port.input_port_id == int(port_id): | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table already has an undo/redo row at line 2159, which I wrote:
host undo / redo (undo() / redo() land in PR #42). Two rows for one operation, and they disagree on the verification column. The fix is to update 2159 and drop this one, rather than add beside it. Line 1786 needs the same treatment: its(PR #42, where undo() and redo() land)becomes false on merge.