Hi Malte,

Welcome to GNU Radio!

On 07/09/2021 23.42, Malte Lenhart wrote:
> This pattern does not seem to be uncommon, but I did not find a single
> instance with existing unit tests unfortunately..

Have a look at gr-zeromq's unit tests - [1], [2].

> Problem: when executing the python unit test, self.tb.run() blocks
> forever as the thread does not terminate. This only happens if the block
> is connected to another one in the flow graph.

Instead of tb.run() you can use tb.start(), tb.stop() and tb.wait()

[1] 
https://github.com/gnuradio/gnuradio/blob/4c6ae3a386ec19698a8c01144c4e8a52fc113404/gr-zeromq/python/zeromq/qa_zeromq_sub.py#L43-L49
[2] 
https://github.com/gnuradio/gnuradio/blob/4c6ae3a386ec19698a8c01144c4e8a52fc113404/gr-zeromq/python/zeromq/qa_zeromq_pull_msg_source.py#L35-L40

Regards,
Vasil

Reply via email to