Test API package

conftest module

Path: tests/

conftest module for Subarray Node.


Return a dictionary of Tango device change event callbacks with asynchrony support.

Return type



a collections.defaultdict that returns change event callbacks by name.


This method returns the devices whose context are required


Records events and allows assertions


Returns input json string :rtype: String


Json factory for getting json files


Pytest hook; implemented to add the –true-context option, used to indicate that a true Tango subsystem is available, so there is no need for a tango.test_context.MultiDeviceTestContext. :type parser: :param parser: the command line options parser :type parser: argparse.ArgumentParser


Pytest hook; prints info about tango version. :type session: :param session: a pytest Session object :type session: pytest.Session


Setting low Csp subarray leaf node and Sdp subarray leaf node availabilty attribute isSubsystemAvailable as True for aggregation


Setting mid Csp subarray leaf node and Sdp subarray leaf node availabilty attribute isSubsystemAvailable as True for aggregation

tests.conftest.subarray_node(event_recorder, request)

Returns the instance of SubarrayNode class

tests.conftest.tango_context(devices_to_load, request)

This Fixture provide the tango context fixture


Creates a mock callable for asynchronous testing

Return type


common_utils module

Path: tests/test_helpers/

Common utils class for a simple test harness.

class tests.test_helpers.common_utils.SubarrayNode(deployment='MID')

Bases: object

Class for Subarray Node device for test harness

assert_command_completion(unique_id, event_recorder)

Checks if the command was completed successfully.

Raises AssertionError in case of failure.

assert_command_completion_on_device(device_name, expected_state)

Check for device obsState to transition to the correct state.

assert_command_failure(unique_id, exception_message, event_recorder)

Checks if the command pushed the correct error message event on its longRunningCommandResult attribute.

Raises AssertionError in case of failure.


Asserts the SubarrayNode HealthState to be the HealthState specified.

Raises AssertionError in case of failure.


Asserts the SubarrayNode ObsState to be the ObsState specified.

Raises AssertionError in case of failure.


Clears the command call info attribute.


Returns a dictionary with current device ObsStates

Return type



Invoke Abort command on Subarray Node

invoke_and_assert_command_rejected(command_name, exception_message, **kwargs)

Invokes the command on Subarray Node and asserts its rejection. Raises AssertionError in case of failure.

  • command_name (str) – Name of the command to be invoked.

  • exception_message (str) – Exception message to assert after the command is rejected

  • kwargs – Addtional keyword arguments. Example- input_str which is the input parameter for command call.

Return type


invoke_command(command_name, input_str='')

Method to invoke given command on subarray node with given input json if any.

Returns the unique id from command invocation.

Return type


invoke_command_on_device(device_name, command, input_data=None)

Invokes the given command on the device with provided input.

perform_action(device_names, actions)

Performs the said action on the given device


Resets the defect parameters for given devices

set_devices_availability(device_names, availability=True)

Set the device availability to the given value.


Sets the availability of devices with provided parameters. :param device_availability: Dictionary with device names as keys and their availability as values. :dtype: dict

set_devices_defective(device_names, defective_params)

Sets the given devices defective with provided parameters.


Teardown for integration and acceptance testing. Brings the subarray node back to EMPTY state.

Raises given exception if the flag is set True.

wait_for_attribute_to_change_to(device, attribute_name, attribute_value)

Wait for the attribute to change to given value.

  • device (str) – Name of the device

  • attribute_name (str) – Attribute name as a string

  • attribute_value (Any) – Value of attribute to be asserted

Return type


wait_for_leaf_node_obsstate(device_name, obsstate, timeout=100)

Wait for Device ObsState to be the given obsstate till timeout occurs.

Raises Exception in case of a timeout.

wait_for_subarray_healthstate(healthstate, timeout=60)

Wait for Subarray Node healthState to be the given Healthstate till timeout occurs.

Raises Exception in case of a timeout.

wait_for_subarray_obsstate(obsstate, timeout=100)

Wait for Subarray Node ObsState to be the given obsstate till timeout occurs.

Raises Exception in case of a timeout.


A decorator to retry command invocation if it fails due to unavailability.

Return type


Module contents