set_test_topic_subname

lsst.ts.salobj.set_test_topic_subname(randomize: bool = False) None

Set a test value for environment variable LSST_TOPIC_SUBNAME

Parameters:
randomizebool

If set to True create a random topic subname.

Notes

Call this for each unit test method that uses SAL message passing, in order to avoid collisions with other tests. Note that pytest can run unit test methods in parallel.

By default (randomize=False), the topic subname value is generated using the os.getpid(). Since parallel tests in pytest uses different processes, this avoids collisions with previous test runs and reduces the number of schema and topics creation.

If a more fine grained isolation mechanism is needed one can pass randomize=True, which will generate a random unique topic subname using os.urandom.