%PDF- %PDF-
Direktori : /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/ |
Current File : //opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyo |
� ��SSc @ s; d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z m Z e j d � Z e j d � Z d � Z d � Z d � Z d � Z d � Z d e f d � � YZ d e f d � � YZ d S( s� This plugin provides test results in the standard XUnit XML format. It's designed for the `Jenkins`_ (previously Hudson) continuous build system, but will probably work for anything else that understands an XUnit-formatted XML representation of test results. Add this shell command to your builder :: nosetests --with-xunit And by default a file named nosetests.xml will be written to the working directory. In a Jenkins builder, tick the box named "Publish JUnit test result report" under the Post-build Actions and enter this value for Test report XMLs:: **/nosetests.xml If you need to change the name or location of the file, you can set the ``--xunit-file`` option. Here is an abbreviated version of what an XML test report might look like:: <?xml version="1.0" encoding="UTF-8"?> <testsuite name="nosetests" tests="1" errors="1" failures="0" skip="0"> <testcase classname="path_to_test_suite.TestSomething" name="test_it" time="0"> <error type="exceptions.TypeError" message="oops, wrong type"> Traceback (most recent call last): ... TypeError: oops, wrong type </error> </testcase> </testsuite> .. _Jenkins: http://jenkins-ci.org/ i����N( t StringIO( t time( t saxutils( t Plugin( t SkipTest( t force_unicodet format_exceptions [\000-\010\013\014\016-\037]s ^(.*?)(\(.*\))$c C s t j d | � S( s) Replaces invalid XML characters with '?'.t ?( t CONTROL_CHARACTERSt sub( t value( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt xml_safe; s c C s t | � j d d � S( s) Escape a string for an XML CDATA section.s ]]>s ]]>]]><![CDATA[( R t replace( t cdata( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt escape_cdata? s c C sa t j | � } | rM | j � \ } } | j d d � \ } } | | | g S| j d d � Sd S( Nt .i ( t TEST_IDt matcht groupst rsplit( t idvalt mt namet fargst headt tail( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt id_splitC s c C s} t j | � r | j } n | j j } t j | � } | ru | j } | j d � rg | t d � } n d | | f S| Sd S( s� Returns a nice name for class object or class instance. >>> nice_classname(Exception()) # doctest: +ELLIPSIS '...Exception' >>> nice_classname(Exception) # doctest: +ELLIPSIS '...Exception' s org.python.core.s %s.%sN( t inspectt isclasst __name__t __class__t getmodulet startswitht len( t objt cls_namet modR ( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt nice_classnameL s c C s� | d } | d k r# | d } nU y t | � } WnB t k rw y t | � } Wqx t k rs | j d } qx Xn Xt | d � } t | � S( s Return the exception's message.i i s UTF-8N( t Nonet strt UnicodeEncodeErrort unicodet UnicodeErrort argsR R ( t exc_infot exct result( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt exc_messagec s t Teec B s5 e Z d � Z d � Z d � Z d � Z d � Z RS( c G s | | _ | | _ d S( N( t _encodingt _streams( t selft encodingR+ ( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt __init__w s c C s7 t | | j � } x | j D] } | j | � q Wd S( N( R R1 R2 t write( R3 t datat s( ( sC /opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR6 { s c C s"