Add test context support for memorized attributes

This pull request provides DeviceTestContext and MultiDeviceTestContext support for memorized attributes. This has value because it allows lightweight testing of device initialisation where device attributes are memorized.

The implementation provides a memorized argument that is handled just like the properties argument:

  • For DeviceTestContext, a new constructor argument is added:
    with DeviceTestContext(TestDevice, memorized={"attr": "1"}) as proxy:
       asserty proxy.attr == 1
  • For MultiDeviceTestContext, the devices_info structure has a new memorized key:
    devices_info = (
        {
            "class": TestDevice,
            "devices": [
                {
                    "name": "test/device1/1",
                    "memorized": {"attr": "1"}
                },
            ]
        }
    )
    with MultiDeviceTestContext(devices_info) as context:
        proxy = context.get_device("test/device1/1")
        assert proxy.attr == 1

Merge request reports

Loading