[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Solved] Re: Unit testing of message passing blocks
From: |
Malte Lenhart |
Subject: |
[Solved] Re: Unit testing of message passing blocks |
Date: |
Wed, 8 Sep 2021 22:48:20 +0200 |
Hi Vasil,
thanks so much for your instant and helpful answer! That is exactly what
I looked for!
On 08.09.21 08:54, Vasil Velichkov wrote:
> Have a look at gr-zeromq's unit tests - [1], [2].
> Instead of tb.run() you can use tb.start(), tb.stop() and tb.wait()
So summarizing what has been missing for me:
- add a stop() method to the block
- use start(), stop() and wait() in the unit test instead of run()
I looked mainly in the gr-blocks folder because that is referenced
mostly in the documentation. I wrote a unit test for the message strobe
block, testing against the message debug block [1]. I thought a test in
the gr-blocks will improve the visibility of your testing approach. Plus
another block has a unit test then.
As stated in the PR, I was wondering if using the same test for the
message debug block would be beneficial (one more block w/ test) or
unnecessary (duplicated code, additional test time). I would be very
happy for short feedback on that.
Closing remark: start() and wait() don't seem to be documented in the
python unittest page [2], is this gnu radio specific? (the question is
rather, should it be documented somewhere and if yes where :-) )
Thanks so much and best regards
Malte
[1] https://github.com/gnuradio/gnuradio/pull/5053
[2] https://docs.python.org/3/library/unittest.html#unittest.TestResult.stop
OpenPGP_signature
Description: OpenPGP digital signature