TestScript#
- class lsst.ts.salobj.TestScript(index, descr='test script')#
Bases:
BaseScriptTest script to allow testing BaseScript.
- Parameters:
Methods Summary
cleanup()Perform final cleanup, if any.
configure(config)Configure the script.
Return a jsonschema to validate configuration, as a
dict.run()Run the script.
set_metadata(metadata)Set metadata fields in the provided struct, given the current configuration.
Methods Documentation
- async cleanup()#
Perform final cleanup, if any.
This method is called as the script state is exiting, unless the script had not yet started to run, or the script process is aborted by SIGTERM or SIGKILL.
- Return type:
- async configure(config)#
Configure the script.
- Parameters:
config (
types.SimpleNamespace) – Configuration, as described byschema.- Raises:
salobj.ExpectedError – If
wait_time < 0. This can be used to make config fail.- Return type:
- classmethod get_schema()#
Return a jsonschema to validate configuration, as a
dict.Please provide default values for all fields for which defaults make sense. This makes the script easier to use.
If your script has no configuration then return
None, in which case theconfigfield of theconfigurecommand must be an empty string.
- async run()#
Run the script.
Your subclass must provide an implementation, as follows: :rtype:
NoneAt points where you support pausing call
checkpoint.Raise an exception on error. Raise
base.ExpectedErrorto avoid logging a traceback.
Notes
This method is only called when the script state is
ScriptState.CONFIGURED. The remaining state transitions are handled automatically.
- set_metadata(metadata)#
Set metadata fields in the provided struct, given the current configuration.
- Parameters:
metadata (
self.evt_metadata.DataType()) – Metadata to update. Set those fields for which you have useful information.- Return type:
Notes
This method is called after
configurebydo_configure. The script state will beScriptState.UNCONFIGURED.