Bug #1119
The Python test interface seems to be broken
Status: | Closed | Start date: | 01/29/2014 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 00-08-01 | |||
Duration: |
Description
The following code (in test_CTA.py
) does not lead to a test failure, although it should:
# Test PSF values self.test_assert(False, "My test") self.test_value(psf(0.0, 0.0, 0.0), 10.0)
The XML test report does not show any trace of the tests, here is what is written in the XML file:
<testsuite disabled="" errors="0" failures="0" hostname="" id="14" name="CTA" package="" skipped="" tests="3" time="0.036592" timestamp="1390992479"> <testcase assertions="" classname="Python interface testing" name="Test CTA effective area classes" status="" time="0.003546" /> <testcase assertions="" classname="Python interface testing" name="Test CTA PSF classes" status="" time="0.00542784" /> <testcase assertions="" classname="Python interface testing" name="Test CTA ON/OFF analysis" status="" time="0.0276182" /> </testsuite>
Here is what is going into the log file:
Test CTA PSF classes: .FF.................... ok
It looks like the tests are executed, but they seem to be not propagated to the XML file and the final error message.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen almost 11 years ago
- Assigned To set to Knödlseder Jürgen
- Target version set to 00-08-01
#2 Updated by Knödlseder Jürgen almost 11 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
This was a pretty subtle problem, related to the way how Python unit tests are called through the swig interface. In fact, the information collected during the unit test was lest, and no tracking of failures and errors was done. Additionally, all test result information was missing from the XML file.
I managed to find a work around that recovers the pointer to the test results and that covers over the relevant information. This includes a kluge that corrects the test case names which also get screwed up (the name of the first test suite is always prepended, even if subsequent test suites are run). Not sure why this kluge is needed, but this may be related to the way how swig calls the test suite class. In any case, the kluge seems to work and we now have Python test results propagated properly to the XML file.