2 -~ : d dl mZ d dlmZ G d de ZdS ) )Document) Formatterc e Zd ZdZddZdS )XunitFormatterz This formatter outputs messages in the Xunit xml format, which is used by several CI tools to parse output. This formatter is therefore a compatibility shim between tools built to use Xunit and prospector itself. TFc t }| d }| dt | j d | dd | ddd | j d z | d t | j d | dt | j d | | | d }| | | d }| | d | | | d }| | d | | t | j D ]l} | d } | d| | j j d| j j | d }| d| j | dd| j z d}|| | j j | j j | j | j | j j | j dz } | | | | | | | n| S )N testsuiteerrors message_countfailures0namez prospector-%s-toolsteststime time_taken propertiesz system-out z system-errtestcaseerrormessagetypez%s ErrorzC%(path)s:%(line)s: [%(code)s(%(source)s), %(function)s] %(message)s)pathlinesourcecodefunctionr )r createElementsetAttributestrsummaryjoinappendChildcreateCDATASectionsortedmessages _make_pathlocationr r r stripr r r toprettyxml)selfr! r&