%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyo

�
��SSc@s;dZddlZddlZddlZddlZddlZddlZddlZddlmZddl	m	Z	ddl
mZddlm
Z
ddlmZddlmZmZejd	�Zejd
�Zd�Zd�Zd
�Zd�Zd�Zdefd��YZde
fd��YZdS(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(tStringIO(ttime(tsaxutils(tPlugin(tSkipTest(t
force_unicodetformat_exceptions[\000-\010\013\014\016-\037]s^(.*?)(\(.*\))$cCstjd|�S(s)Replaces invalid XML characters with '?'.t?(tCONTROL_CHARACTERStsub(tvalue((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytxml_safe;scCst|�jdd�S(s)Escape a string for an XML CDATA section.s]]>s]]>]]&gt;<![CDATA[(Rtreplace(tcdata((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytescape_cdata?scCsatj|�}|rM|j�\}}|jdd�\}}|||gS|jdd�SdS(Nt.i(tTEST_IDtmatchtgroupstrsplit(tidvaltmtnametfargstheadttail((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytid_splitCscCs}tj|�r|j}n|jj}tj|�}|ru|j}|jd�rg|td�}nd||fS|SdS(s�Returns a nice name for class object or class instance.

        >>> nice_classname(Exception()) # doctest: +ELLIPSIS
        '...Exception'
        >>> nice_classname(Exception) # doctest: +ELLIPSIS
        '...Exception'

    sorg.python.core.s%s.%sN(tinspecttisclasst__name__t	__class__t	getmodulet
startswithtlen(tobjtcls_nametmodR((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytnice_classnameLs		cCs�|d}|dkr#|d}nUyt|�}WnBtk
rwyt|�}Wqxtk
rs|jd}qxXnXt|d�}t|�S(sReturn the exception's message.iisUTF-8N(tNonetstrtUnicodeEncodeErrortunicodetUnicodeErrortargsRR(texc_infotexctresult((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytexc_messagecs



tTeecBs5eZd�Zd�Zd�Zd�Zd�ZRS(cGs||_||_dS(N(t	_encodingt_streams(tselftencodingR+((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt__init__ws	cCs7t||j�}x|jD]}|j|�qWdS(N(RR1R2twrite(R3tdatats((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR6{scCs"x|D]}|j|�qWdS(N(R6(R3tlinestline((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
writelines�s
cCs"x|jD]}|j�q
WdS(N(R2tflush(R3R8((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR<�scCstS(N(tFalse(R3((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytisatty�s(Rt
__module__R5R6R;R<R>(((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR0vs
				tXunitcBs�eZdZdZdZdZdZd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zdd�Zddd�Zdd�ZRS(sCThis plugin provides test results in the standard XUnit XML format.txuniti�sUTF-8cCs2tt|�j�g|_d|_d|_dS(N(tsuperR@R5t_capture_stackR&t_currentStdoutt_currentStderr(R3((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR5�s		cCs,t|d�r"t�|j}nd}|S(Nt_timerg(thasattrRRF(R3ttaken((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
_timeTaken�scCst|�}tj|�S(s.Escape an XML attribute. Value can be unicode.(RRt	quoteattr(R3tattr((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
_quoteattr�scCsNtj|||�|jdddddddd|jd	d
�dd�d
S(s%Sets additional command line options.s--xunit-filetactiontstoretdestt
xunit_filetmetavartFILEtdefaulttNOSE_XUNIT_FILEs
nosetests.xmlthelpsrPath to xml file to store the xunit report in. Default is nosetests.xml in the working directory [NOSE_XUNIT_FILE]N(Rtoptionst
add_optiontget(R3tparsertenv((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyRV�scCsrtj|||�||_|jrnidd6dd6dd6dd6|_g|_tjj|j	�|_
ndS(sConfigures the xunit plugin.iterrorstfailurestpassestskippedN(Rt	configuretconfigtenabledtstatst	errorlisttostpathtrealpathRPterror_report_file_name(R3RVR`((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR_�s		

	cCstj|jd|jd�|_|j|jd<|jd|jd|jd|jd|jd<|jjd	|j�|jjd
jg|jD]}t	||j�^q���|jjd�|jj
�|jjdkr|j
d
d�|j
d|jj�ndS(smWrites an Xunit-formatted XML file

        The file includes a report of test errors and failures.

        twRR4R[R\R]R^ttotalu�<?xml version="1.0" encoding="%(encoding)s"?><testsuite name="nosetests" tests="%(total)d" errors="%(errors)d" failures="%(failures)d" skip="%(skipped)d">uu</testsuite>it-iFsXML: %sN(tcodecstopenRgR4terror_report_fileRbR6tjoinRcRtcloseR`t	verbositytwritelnR(R3tstreamte((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytreport�s5	)
cCst|jjtjtjf�t�|_t�|_t|j	|jtj�t_t|j	|jtj�t_dS(N(
RCtappendtsyststdouttstderrRRDRER0R4(R3((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
_startCapture�s
cCs|j�dS(N(Ry(R3tcontext((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytstartContext�scCs|j�dS(N(t_endCapture(R3Rz((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytstopContext�scCst�|_|j�dS(s+Initializes a timer before starting a test.N(RRFRy(R3ttest((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
beforeTest�scCs+|jr'|jj�\t_t_ndS(N(RCtpopRvRwRx(R3((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR|�s	cCs |j�d|_d|_dS(N(R|R&RDRE(R3R~((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt	afterTest�s
	cCsx|jr|j�qWdS(N(RCR|(R3R~((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytfinalize�scCs3|jr/|jj�}|r/dt|�SndS(Ns'<system-out><![CDATA[%s]]></system-out>t(RDtgetvalueR(R3R
((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt_getCapturedStdout�s	cCs3|jr/|jj�}|r/dt|�SndS(Ns'<system-err><![CDATA[%s]]></system-err>R�(RER�R(R3R
((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt_getCapturedStderr�s	cCs#|j�}t|dt�r;d}|jdcd7<nd}|jdcd7<t||j�}|j�}|jjdi	|j	t
|�d�d6|j	t
|�d�d	6|d
6|d6|j	t|d��d6|j	t|��d
6t
|�d6|j�d6|j�d6�dS(s*Add error output to Xunit report.
        iR^iterrorR[u�<testcase classname=%(cls)s name=%(name)s time="%(taken).3f"><%(type)s type=%(errtype)s message=%(message)s><![CDATA[%(tb)s]]></%(type)s>%(systemout)s%(systemerr)s</testcase>tclsi����RRHttypeterrtypetmessagettbt	systemoutt	systemerrN(RIt
issubclassRRbRR4tidRcRuRLRR%R/RR�R�(R3R~terrtcaptRHR�R�R�((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pytaddErrors&	

cCs�|j�}t||j�}|jdcd7<|j�}|jjdi|jt|�d�d6|jt|�d�d6|d6|jt	|d��d	6|jt
|��d
6t|�d6|j�d6|j
�d
6�dS(s,Add failure output to Xunit report.
        R\iu�<testcase classname=%(cls)s name=%(name)s time="%(taken).3f"><failure type=%(errtype)s message=%(message)s><![CDATA[%(tb)s]]></failure>%(systemout)s%(systemerr)s</testcase>iR�i����RRHR�R�R�R�R�N(RIRR4RbR�RcRuRLRR%R/RR�R�(R3R~R�R�ttb_infoRHR�R�((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
addFailure%s	

cCs�|j�}|jdcd7<|j�}|jjdi|jt|�d�d6|jt|�d�d6|d6|j�d	6|j�d
6�dS(s,Add success output to Xunit report.
        R]isb<testcase classname=%(cls)s name=%(name)s time="%(taken).3f">%(systemout)s%(systemerr)s</testcase>iR�i����RRHR�R�N(	RIRbR�RcRuRLRR�R�(R3R~R�RHR�((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt
addSuccess;s	
N(RR?t__doc__RtscoreR4R&RmR5RIRLRVR_RtRyR{R}RR|R�R�R�R�R�R�R�(((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyR@�s.		
			
										(R�RktdoctestRdRvt	tracebacktreRRRtxml.saxRtnose.plugins.baseRtnose.excRtnose.pyversionRRtcompileRRRRRR%R/tobjectR0R@(((sC/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/xunit.pyt<module>&s,						

Zerion Mini Shell 1.0