MockWriteTopic#
- class lsst.ts.salobj.topics.MockWriteTopic(*, salinfo, attr_name, min_seq_num=1, max_seq_num=2147483647, initial_seq_num=None)#
Bases:
WriteTopicA version of WriteTopic that records every message written instead of actually writing it.
It is easiest to construct these by calling
make_mock_write_topics. MockWriteTopic is only intended for unit tests and related short-term use; it saves every message, so long term use will leak memory.- Parameters:
salinfo (
SalInfo) – SAL component informationattr_name (
str) – Topic name with attribute prefix. The prefix must be one of:cmd_,evt_,tel_, or (only for the ackcmd topic)ack_.min_seq_num (
intorNone, optional) – Minimum value for theprivate_seqNumfield. The default is 1. IfNonethenprivate_seqNumis not set; this is needed for the ackcmd writer, which sets the field itself.max_seq_num (
int, optional) – Maximum value forprivate_seqNum, inclusive. The default is the maximum allowed positive value (private_seqNumis a 4-byte signed int). Ignored ifmin_seq_numisNone.initial_seq_num (
int, optional) – Initial sequence number; ifNoneuse min_seq_num.
- Plus the attributes of
Methods Summary
write()Write the current data and return a copy of the data written.
Methods Documentation
- async write()#
Write the current data and return a copy of the data written.
- Returns:
data – The data that was written. This can be useful to avoid race conditions (as found in RemoteCommand).
- Return type:
type_hints.BaseMsgType- Raises:
RuntimeError – If not running.