Mock device
This module implements infrastructure for mocking tango devices.
- class MockDeviceBuilder(from_factory=<class 'unittest.mock.Mock'>)
This module implements a mock builder for tango devices.
- __init__(from_factory=<class 'unittest.mock.Mock'>)
Create a new instance.
- add_attribute(name, value)
Tell this builder to build mocks with a given attribute.
TODO: distinguish between read-only and read-write attributes
- add_command(name, return_value)
Tell this builder to build mocks with a specified command.
And that the command returns the provided value.
- add_result_command(name, result_code, status='Mock information-only message')
Tell this builder to build mocks with a specified command.
And that the command returns (ResultCode, [message, message_uid]) or (ResultCode, message) tuples as required.
- Parameters:
name (
str
) – the name of the commandresult_code (
ResultCode
) – code indicating the status of the commandstatus (
str
) – an information-only message for the command to return
- Return type: