The automated mock-hardware test suite that every PLESTY device module must pass before reaching CI.
Gate d1 is a new device-tier validation gate in plesty check. It is automatically activated when your module declares module_type = "device" in [tool.plesty] of pyproject.toml. For all other module types the gate is silently skipped.
When active, Gate d1 collects all test node IDs in your tests/ directory and verifies that all eight standard mock-gate functions are present and pass — without any real hardware connected. It uses pytest under the hood with a filter that runs only the pipeline functions, so your broader test suite is unaffected.
The goal is to guarantee that every device module in the PLESTY HUB exposes a consistent, contract-compliant API that experiment authors can depend on — regardless of the underlying vendor protocol.
schema_param.json and schema_func.json are present, parseable JSON, and structurally valid.get_config_list() resolves successfully through get_config(key) on the mock device.set_config(key, val) followed by get_config(key) returns the same value.schema_func.json is callable on the mock device and returns a dict response.is_operatable == True → disconnect completes cleanly without raising.identity() returns a non-empty string (e.g. the IDN response), proving the device has a recognisable self-description.check_errors() returns an empty list [] on a healthy mock device — not None, not a raised exception.dev.state is a dict whose keys are a superset of get_config_list(), ensuring the state snapshot captures all declared parameters.module_type = "device" in pyproject.tomlplesty check will print Device API Pipeline (N/A — not a device module) and skip the gate entirely.Device and replace the transport with a MagicMock. Use a unique UUID-based address per instance to prevent resource-registry collisions between tests. The mock transport's send_command returns a safe default response.
PIPELINE constant at module level. Pass your mock device class and paths to both schema files. The paths can be relative to the project root or use importlib.resources.files() for package-internal assets.plesty check and verify Gate d1 passesBefore Gate d1, two device modules could both pass plesty check while exposing completely different APIs — one using connect(), another using open(); one returning dicts from operations, another returning raw strings. Experiment authors had no guarantee.
Gate d1 makes this a hard CI failure. If the 8 functions are missing or one throws, you see:
With Gate d1: every device module in the PLESTY HUB guarantees connect/disconnect, identity(), check_errors() → [], schema round-trips, and state coverage before it ever reaches CI. Experiment authors can trust the contract.