Hi Vasil,
> First you need to import square2_ff from howto similar to line 13 and then you can use square2_ff directly without howto infront.
It shouldn't matter whether I use `howto.square2_ff()` or import and then use `square2_ff()`. Both should work in python. But anyway, this was of course something I tried, and it did not help. However, the error message is different and might provide clues as to what causes the issue. This is the error message I get when I try to import first:
~/gr-howto/build$ ctest -V
UpdateCTestConfiguration from :/home/antonott/gr-howto/build/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/antonott/gr-howto/build/DartConfiguration.tcl
Test project /home/antonott/gr-howto/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: qa_square_ff
1: Test command: /usr/bin/sh "/home/antonott/gr-howto/build/python/qa_square_ff_test.sh"
1: Test timeout computed to be: 10000000
1: .E.
1: ======================================================================
1: ERROR: test_002_square2_ff (__main__.qa_square_ff)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 31, in wrapped
1: endp = [(p.to_basic_block(), 0) if hasattr(p, 'to_basic_block')
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 32, in <listcomp>
1: else (p[0].to_basic_block(), p[1]) for p in points]
1: TypeError: 'howto.howto_python.square2_ff' object is not subscriptable
1:
1: During handling of the above exception, another exception occurred:
1:
1: Traceback (most recent call last):
1: File "/home/antonott/gr-howto/python/qa_square_ff.py", line 52, in test_002_square2_ff
1: self.tb.connect(src, sqr, dst)
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 34, in wrapped
1: raise ValueError("Unable to coerce endpoints: " + str(err))
1: ValueError: Unable to coerce endpoints: 'howto.howto_python.square2_ff' object is not subscriptable
1:
1: ----------------------------------------------------------------------
1: Ran 3 tests in 0.003s
1:
1: FAILED (errors=1)
1: DEPRECATED: Using filename with gr_unittest does no longer have any effect.
1/1 Test #1: qa_square_ff .....................***Failed 0.22 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.22 sec
The following tests FAILED:
1 - qa_square_ff (Failed)
Errors while running CTest
And by the way, the connect syntax `self.tb.connect(src, sqr, dst)` is not responsible for the error. I get a similar error if I use `self.tb.connect(src, sqr)` followed by `self.tb.connect(sqr, dst)` (as in the previous test).UpdateCTestConfiguration from :/home/antonott/gr-howto/build/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/antonott/gr-howto/build/DartConfiguration.tcl
Test project /home/antonott/gr-howto/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: qa_square_ff
1: Test command: /usr/bin/sh "/home/antonott/gr-howto/build/python/qa_square_ff_test.sh"
1: Test timeout computed to be: 10000000
1: .E.
1: ======================================================================
1: ERROR: test_002_square2_ff (__main__.qa_square_ff)
1: ----------------------------------------------------------------------
1: Traceback (most recent call last):
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 31, in wrapped
1: endp = [(p.to_basic_block(), 0) if hasattr(p, 'to_basic_block')
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 32, in <listcomp>
1: else (p[0].to_basic_block(), p[1]) for p in points]
1: TypeError: 'howto.howto_python.square2_ff' object is not subscriptable
1:
1: During handling of the above exception, another exception occurred:
1:
1: Traceback (most recent call last):
1: File "/home/antonott/gr-howto/python/qa_square_ff.py", line 52, in test_002_square2_ff
1: self.tb.connect(src, sqr, dst)
1: File "/usr/lib/python3/dist-packages/gnuradio/gr/hier_block2.py", line 34, in wrapped
1: raise ValueError("Unable to coerce endpoints: " + str(err))
1: ValueError: Unable to coerce endpoints: 'howto.howto_python.square2_ff' object is not subscriptable
1:
1: ----------------------------------------------------------------------
1: Ran 3 tests in 0.003s
1:
1: FAILED (errors=1)
1: DEPRECATED: Using filename with gr_unittest does no longer have any effect.
1/1 Test #1: qa_square_ff .....................***Failed 0.22 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.22 sec
The following tests FAILED:
1 - qa_square_ff (Failed)
Errors while running CTest
> Usually you would add a separate qa_* class for each block you have.
Sure, but I am just following the tutorial here. In fact I tried adding a separate QA class for the second block in an earlier attempt to get past the problem, but I ran into trouble then as well. I might take another look at that though.
> Not sure what you mean by "reflection" here.
Testing frameworks typically use reflection (https://en.wikipedia.org/wiki/Reflective_programming) to set up and run the tests. And the OOT tutorial specifically mentions that "Unittest uses Python's reflection mechanism to find all methods that start with test_ and runs them.".
Best regards,
Anton
From: Vasil Velichkov <vvvelichkov@gmail.com>
Sent: Wednesday, June 30, 2021 7:33 AM
To: Anton Ottosson
Cc: Discuss Gnuradio
Subject: Re: OOT tests failing in GNU Radio 3.9.2.0, Ubuntu 20.04.2 LTS
Sent: Wednesday, June 30, 2021 7:33 AM
To: Anton Ottosson
Cc: Discuss Gnuradio
Subject: Re: OOT tests failing in GNU Radio 3.9.2.0, Ubuntu 20.04.2 LTS
Hi Anton,
On Tue, Jun 29, 2021, 21:04 Anton Ottosson <antonott@kth.se> wrote:
1: Traceback (most recent call last):
1: File "/home/antonott/gr-howto/python/qa_square_ff.py", line 50, in test_002_square2_ff
1: sqr = howto.square2_ff()
1: NameError: name 'howto' is not defined
First you need to import square2_ff from howto similar to line 13 and then you can use square2_ff directly without howto infront.
from howto import square_ff, square2_ff
sqr = square2_ff()
1: ----------------------------------------------------------------------
1: Ran 3 tests in 0.003s
1:
1: FAILED (errors=1)
1: DEPRECATED: Using filename with gr_unittest does no longer have any effect.
1/1 Test #1: qa_square_ff .....................***Failed 0.22 sec
Usually you would add a separate qa_* class for each block you have.
Though I guess since the unit tests are executed with reflection anything is possible.
Not sure what you mean by "reflection" here.
Regards,
Vasil
No comments:
Post a Comment