I am also noticing that the unit test runs twice.  Is there a particular
reason for that?  Also, if I call self.assertTrue() on something I know is
false ('1 == 2' for example) before self.tb.stop() is called, the test just
hangs.  If I call self.tb.stop() and then call the same assert statement,
the test exits, but does not report the failure.  I am testing a source
block that only outputs PMTs and does so forever.  I also tried calling
myBlock.stop() in hopes that the stop() method would call the destructor
but that didn't happen.  How does one go about stopping a PMT only test
bench?

On Tue, Jun 7, 2016 at 6:45 PM, Dave NotTelling <dmp250...@gmail.com> wrote:

> I would like to make some unit tests for a PMT only block I created, but I
> haven't been able to find any good examples aside from a StackOverflow post
> (
> http://stackoverflow.com/questions/36342285/testing-a-gnu-radio-message-accepting-block-with-post).
> The hope was that I could simply access the message port of the block under
> test and shove PMT messages in there.  Is that even possible?  I tried
> making a custom block as outlined in
> https://github.com/gnuradio/gnuradio/blob/master/gr-blocks/python/blocks/qa_python_message_passing.py
> with the slight tweak of having a method called 'send' in the producer that
> would send whatever PMT object you provide as an argument out to the output
> message port.  That fails with:
>
> message_gen.send(pmt.intern('asdf'))
> TypeError: unbound method send() must be called with message_gen instance
> as first argument (got swig_int_ptr instance instead)
>
>
> Any tips to test a block like this?
>
> Thanks!
>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to