Hi Dave, if you need a block that just passes messages, try the Message Strobe. If this is not what you want, can you please publish your block code so we can reproduce the behaivour? From your error message, maybe you have forgotten to put the "self" parameter in the method declaration? That is always needed in python as first parameter of class methods. Also, when you want to test flowgraphs with PMTs, you can't use "self.tb.run()" but have to use a structure like this:
# connecting and block instancing self.tb.start() time.sleep(0.5) self.tb.stop() self.tb.wait() # assertion checks This lets the flowgraph run for 0.5 secs and stops it again. Cheers, Sebastian 2016-06-09 15:47 GMT+02:00 Dave NotTelling <dmp250...@gmail.com>: > 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 > >
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio