Testing

Testing helpers for SKA Tango devices.

This module must be explicitly imported when needed, as it is not exposed by the top-level ska_tango_base.future module:

import ska_tango_base.testing as stbt

It is intended for use in unit tests and other testing contexts.

ska_tango_base.testing.bus_test_context(*observers: ObserverProtocol) Generator[BusProtocol, None, None][source]

Context manager that provides a temporary signal bus for testing.

Automatically registers the provided observers before starting emission processing. Any instances of SharingObserver will have their shared_bus property assigned instead of being register directly.

Parameters:

observers – The observers to be registered with the bus.

Returns:

The signal bus instance.

class ska_tango_base.testing.MockSignalObserver[source]

Mock observer that allows asserting that specific signals were emitted.

This is only available if ska_tango_testing can be imported.

notify_emission(signal: str, value: Any) None[source]

Notify the observer of an emission asynchronously.

Parameters:
  • signal – The name of the signal emitted.

  • value – The value emitted on the signal.