cosmic-ray
cosmic-ray copied to clipboard
(worker_outcome=exception + test_outcome=incompetent) has no diff, leading to traceback in cr-xml
Working on cr-xml
from cosmic-ray 5.5.0
, I noticed the following error:
Traceback (most recent call last):
File "/home/fr33ky/.local/bin/cr-xml", line 10, in <module>
sys.exit(report_xml())
File "/home/fr33ky/.local/lib/python3.7/site-packages/cosmic_ray/tools/xml.py", line 21, in report_xml
xml_elem = _create_xml_report(db)
File "/home/fr33ky/.local/lib/python3.7/site-packages/cosmic_ray/tools/xml.py", line 43, in _create_xml_report
subelement = _update_element_with_result(subelement, result)
File "/home/fr33ky/.local/lib/python3.7/site-packages/cosmic_ray/tools/xml.py", line 74, in _update_element_with_result
error_elem.text = str(data) + "\n".join(result.diff)
TypeError: can only join an iterable
Checking sources I noticed that, in src/cosmic_ray/worker.py
, from line 77, a WorkResult
is returned with no diff
set.
There are then 3 solutions:
- set
diff
inworker.py
even for exception - check if diff is not null in
src/cosmic_ray/tools/xml.py
(_update_element_with_result
) - both
Thanks for pointing this out. I think your second solution is the right way to go (i.e. check the diff for None
).