ó
    Eñi²c  ã                  ój  • S r SSKJr  SSKJr  SSKrSSKrSSKrSSKrSSK	J
s  Jr  SSKJr  SSKJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK r \S   " 5       r!S*S jr"S+S jr#SSS/0S/ SQ0S.r$\$S   RK                  5       \$S'   \#" \$S   \$S   5        \$S   \$S'    " S S5      r&      S,S jr'\ RP                  S-S j5       r)\ RP                  S-S  j5       r*S.S! jr+\ RP                  " S"S#9S-S$ j5       r,S/S% jr-S0S& jr.S0S' jr/S1S( jr0 " S) S5      r1g)2a  Report test results in JUnit-XML format, for use with Jenkins and build
integration servers.

Based on initial code from Ross Lawley.

Output conforms to
https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd
é    )Úannotations)ÚCallableN)Únodes)Útiming)ÚExceptionRepr)ÚReprFileLocation)ÚConfig)Úfilename_arg)ÚParser)ÚFixtureRequest)Ú
TestReport)ÚStashKey)ÚTerminalReporterÚLogXMLc                óP   • SS jnSn[         R                  " X![        U 5      5      $ )a  Visually escape invalid XML characters.

For example, transforms
    'hello\aworld\b'
into
    'hello#x07world#x08'
Note that the #xABs are *not* XML escapes - missing the ampersand &#xAB.
The idea is to escape visually for the user rather than for XML itself.
c                óX   • [        U R                  5       5      nUS::  a  SUS 3$ SUS 3$ )Néÿ   z#xÚ02XÚ04X)ÚordÚgroup)ÚmatchobjÚis     ÚM/home/mande/repo/quber/.venv/lib/python3.13/site-packages/_pytest/junitxml.pyÚreplÚbin_xml_escape.<locals>.repl0   s6   € Ü�—‘Ó Ó!ˆØ�‹9Ø˜˜#�w�<Ðà˜˜#�w�<Ðó    u    [^	
 -~Â€-íŸ¿î€€-ï¿½á€€0-áƒ¿ff])r   zre.Match[str]ÚreturnÚstr)ÚreÚsubr   )Úargr   Úillegal_xml_res      r   Úbin_xml_escaper$   %   s)   € ô ð 	Wð ô �6Š6�.¬¨C«Ó1Ð1r   c                óì   • 0 nU R                  5        HM  u  p4UR                  5        H4  u  pV[        U[        5      (       d  [        [	        U5      5      eXF-   X#'   M6     MO     U R                  U5        g ©N)ÚitemsÚ
isinstanceÚlistÚ	TypeErrorÚtypeÚupdate)ÚleftÚrightÚresultÚklÚvlÚkrÚvrs          r   Úmerge_familyr4   @   s^   € Ø€FØ—*‘*–,‰ˆØ—k‘k–m‰FˆBÜ˜b¤$×'Ñ'Ü¤ R£Ó)Ð)Ø™ˆF‹Jó $ñ ð
 	‡K�K�Õr   ÚtestcaseÚ	classnameÚname)ÚfileÚlineÚurl)Ú_baseÚ_base_legacyr;   Úxunit1r<   Úxunit2c                  óÌ   • \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
SSS
 jjrSS jrSS jrS S jrSS jrSS jrSS jrSS jrSS jrSS jrS!S jrSrg	)"Ú_NodeReporteréV   c                óÀ   • Xl         X l        U R                  R                  U l        U R                  R                  U l        SU l        / U l        / U l        0 U l        g )Nç        )ÚidÚxmlÚ	add_statsÚfamilyÚdurationÚ
propertiesr   Úattrs)ÚselfÚnodeidrE   s      r   Ú__init__Ú_NodeReporter.__init__W   sH   € ØŒØŒØŸ™×+Ñ+ˆŒØ—h‘h—o‘oˆŒØˆŒØ13ˆŒØ')ˆŒ
Ø%'ˆ�
r   c                ó„   • U R                   R                  UR                  5        U R                  R	                  U5        g r&   )rE   rF   Útagr   Úappend)rK   Únodes     r   rQ   Ú_NodeReporter.appenda   s*   € Ø�‰×Ñ˜4Ÿ8™8Ô$Ø�
‰
×Ñ˜$Õr   c                ób   • U R                   R                  [        U5      [        U5      45        g r&   )rI   rQ   r   r$   ©rK   r7   Úvalues      r   Úadd_propertyÚ_NodeReporter.add_propertye   s"   € Ø�‰×Ñ¤ D£	¬>¸%Ó+@ÐAÕBr   c                óF   • [        U5      U R                  [        U5      '   g r&   )r$   rJ   r   rU   s      r   Úadd_attributeÚ_NodeReporter.add_attributeh   s   € Ü .¨uÓ 5ˆ�
‰
”3�t“9Òr   c           	     óÈ   • U R                   (       aQ  [        R                  " S5      nU R                    H)  u  p#UR                  [        R                  " SX#S95        M+     U$ g©z9Return a Junit node containing custom properties, if any.rI   Úproperty©r7   rV   N)rI   ÚETÚElementrQ   ©rK   rI   r7   rV   s       r   Úmake_properties_nodeÚ"_NodeReporter.make_properties_nodek   sI   € à�?�?ÜŸš LÓ1ˆJØ#Ÿœ‘�Ø×!Ñ!¤"§*¢*¨Z¸dÑ"PÖQñ  /àÐØr   c                ó¸  • [        UR                  5      nU R                  nUS S nU R                  R                  (       a&  UR                  SU R                  R                  5        SR                  U5      [        US   5      UR                  S   S.nUR                  S   b  [        UR                  S   5      US'   [        US5      (       a  UR                  US'   XPl        U R                  R                  U5        U R                  S:X  a  g 0 nU R                   H0  nU[        U R                     S	   ;   d  M  U R                  U   Xg'   M2     X`l        g )
Néÿÿÿÿr   Ú.)r6   r7   r8   é   r9   r:   r=   r5   )Úmangle_test_addressrL   rJ   rE   ÚprefixÚinsertÚjoinr$   Úlocationr   Úhasattrr:   r,   rG   Úfamilies)rK   Ú
testreportÚnamesÚexisting_attrsÚ
classnamesrJ   Ú
temp_attrsÚkeys           r   Úrecord_testreportÚ_NodeReporter.record_testreportt   s%  € Ü# J×$5Ñ$5Ó6ˆØŸ™ˆØ˜3˜B�Zˆ
Ø�8‰8�?�?Ø×Ñ˜a §¡§¡Ô1àŸ™ *Ó-Ü" 5¨¡9Ó-Ø×'Ñ'¨Ñ*ñ!
ˆð
 ×Ñ˜qÑ!Ñ-Ü 
× 3Ñ 3°AÑ 6Ó7ˆE�&‰MÜ�:˜u×%Ñ%Ø%Ÿ>™>ˆE�%‰LØŒ
Ø�
‰
×Ñ˜.Ô)ð �;‰;˜(Ó"Øð ˆ
Ø—:”:ˆCØ”h˜tŸ{™{Ñ+¨JÑ7Õ7Ø"&§*¡*¨S¡/�
“ñ ð  �
r   c                óÜ   • [         R                  " SU R                  U R                  S S9nU R	                  5       nUb  UR                  U5        UR                  U R                  5        U$ )Nr5   ú.3f)Útime)r`   ra   rJ   rH   rc   rQ   Úextendr   )rK   r5   rI   s      r   Úto_xmlÚ_NodeReporter.to_xml’   sV   € Ü—:’:˜j¨$¯*©*¸d¿m¹mÈCÐ=PÑRˆØ×.Ñ.Ó0ˆ
ØÑ!Ø�O‰O˜JÔ'Ø�‰˜Ÿ
™
Ô#Øˆr   Nc                ón   • [         R                  " XS9n[        U5      Ul        U R	                  U5        g )N)Úmessage©r`   ra   r$   ÚtextrQ   )rK   rP   r   ÚdatarR   s        r   Ú_add_simpleÚ_NodeReporter._add_simpleš   s(   € Ü�zŠz˜#Ñ/ˆÜ" 4Ó(ˆŒ	Ø�‰�DÕr   c                ót  • U R                   R                  (       d  UR                  (       a  g UR                  nUR                  nUR
                  nU R                   R                  S:X  a  g SnU R                   R                  S;   a  U R                  US5      nU R                   R                  S;   a(  XPR                  US5      -  nU R                  XS5        SnU R                   R                  S;   a(  XPR                  US	5      -  nU R                  XS
5        SnU(       a  U R                  XS5        g g )NÚnoÚ )ÚlogÚallz Captured Log )ú
system-outúout-errr‰   z Captured Out rŠ   )ú
system-errr‹   r‰   z Captured Err rŒ   )	rE   Úlog_passing_testsÚpassedÚ	capstdoutÚcaplogÚ	capstderrÚloggingÚ_prepare_contentÚ_write_content)rK   ÚreportÚcontent_outÚcontent_logÚcontent_errÚcontent_alls         r   Úwrite_captured_outputÚ#_NodeReporter.write_captured_outputŸ   s
  € Ø�x‰x×)×)¨f¯m¯mØà×&Ñ&ˆØ—m‘mˆØ×&Ñ&ˆØ�8‰8×Ñ˜tÓ#ØØˆØ�8‰8×Ñ˜~Ó-Ø×/Ñ/°Ð=MÓNˆKØ�8‰8×ÑÐ?Ó?Ø×0Ñ0°Ð>NÓOÑOˆKØ×Ñ °\ÔBØˆKØ�8‰8×ÑÐ?Ó?Ø×0Ñ0°Ð>NÓOÑOˆKØ×Ñ °\ÔBØˆKÞØ×Ñ °\ÕBð r   c                óJ   • SR                  UR                  SS5      US/5      $ )NÚ
éP   Ú-r‡   )rl   Úcenter)rK   ÚcontentÚheaders      r   r“   Ú_NodeReporter._prepare_content¶   s#   € Ø�y‰y˜&Ÿ-™-¨¨CÓ0°'¸2Ð>Ó?Ð?r   c                ór   • [         R                  " U5      n[        U5      Ul        U R	                  U5        g r&   r€   )rK   r•   r¡   ÚjheaderrP   s        r   r”   Ú_NodeReporter._write_content¹   s(   € Ü�jŠj˜Ó!ˆÜ! 'Ó*ˆŒØ�‰�CÕr   c                ó&   • U R                  S5        g )NrŽ   )rF   ©rK   r•   s     r   Úappend_passÚ_NodeReporter.append_pass¾   s   € Ø�‰�xÕ r   c                óD  • [        US5      (       a  U R                  SS5        g UR                  c   e[        UR                  SS 5      nUb  UR                  nO[        UR                  5      n[        U5      nU R                  SU[        UR                  5      5        g )NÚwasxfailÚskippedz%xfail-marked test passes unexpectedlyÚ	reprcrashÚfailure)rn   rƒ   ÚlongreprÚgetattrr   r   r$   )rK   r•   r®   r   s       r   Úappend_failureÚ_NodeReporter.append_failureÁ   s‹   € ä�6˜:×&Ñ&Ø×Ñ˜YÐ(OÕPà—?‘?Ñ.Ð.Ð.Ü18Ø—‘ ¨dó2ˆIð Ñ$Ø#×+Ñ+‘ä˜fŸo™oÓ.�Ü$ WÓ-ˆGØ×Ñ˜Y¨´°V·_±_Ó1EÕFr   c                ón   • UR                   c   eU R                  SS[        UR                   5      5        g )NÚerrorzcollection failure)r°   rƒ   r   r¨   s     r   Úappend_collect_errorÚ"_NodeReporter.append_collect_errorÑ   s.   € à�‰Ñ*Ð*Ð*Ø×Ñ˜Ð"6¼¸F¿O¹OÓ8LÕMr   c                óP   • U R                  SS[        UR                  5      5        g )Nr­   zcollection skipped)rƒ   r   r°   r¨   s     r   Úappend_collect_skippedÚ$_NodeReporter.append_collect_skippedÖ   s   € Ø×Ñ˜Ð$8¼#¸f¿o¹oÓ:NÕOr   c                ó2  • UR                   c   e[        UR                   SS 5      nUb  UR                  nO[        UR                   5      nUR                  S:X  a  SU S3nOSU S3nU R                  S[        U5      [        UR                   5      5        g )Nr®   Úteardownzfailed on teardown with "Ú"zfailed on setup with "rµ   )r°   r±   r   r   Úwhenrƒ   r$   )rK   r•   r®   ÚreasonÚmsgs        r   Úappend_errorÚ_NodeReporter.append_errorÙ   sŒ   € Ø�‰Ñ*Ð*Ð*Ü-4°V·_±_ÀkÐSWÓ-Xˆ	ØÑ Ø×&Ñ&‰Fä˜Ÿ™Ó)ˆFà�;‰;˜*Ó$Ø-¨f¨X°QÐ7‰Cà*¨6¨(°!Ð4ˆCØ×Ñ˜¤.°Ó"5´s¸6¿?¹?Ó7KÕLr   c                ó&  • [        US5      (       aZ  UR                  nUR                  S5      (       a  USS  n[        U5      n[        R
                  " SSUS9nU R                  U5        g [        UR                  [        5      (       d   eUR                  u  pEnUR                  S5      (       a  USS  nU S	U S
U 3n[        R
                  " SS[        U5      S9n[        U5      Ul
        U R                  U5        U R                  U5        g )Nr¬   zreason: é   r­   zpytest.xfail)r+   r   z	Skipped: é	   Ú:z: zpytest.skip)rn   r¬   Ú
startswithr$   r`   ra   rQ   r(   r°   Útupler�   rš   )rK   r•   Úxfailreasonr­   ÚfilenameÚlinenoÚ
skipreasonÚdetailss           r   Úappend_skippedÚ_NodeReporter.append_skippedç   sõ   € Ü�6˜:×&Ñ&Ø Ÿ/™/ˆKØ×%Ñ% j×1Ñ1Ø)¨!¨"˜o�Ü(¨Ó5ˆKÜ—j’j °ÈÑUˆGØ�K‰K˜Õ ä˜fŸo™o¬u×5Ñ5Ð5Ð5Ø+1¯?©?Ñ(ˆH˜jØ×$Ñ$ [×1Ñ1Ø'¨¨˜^�
Ø!˜
 ! F 8¨2¨j¨\Ð:ˆGä—j’jØ ´~ÀjÓ7QñˆGô *¨'Ó2ˆGŒLØ�K‰K˜Ô Ø×&Ñ& vÕ.r   c                óp   ^• U R                  5       mU R                  R                  5         U4S jU l         g )Nc                 ó   >• T $ r&   © )r‚   s   €r   Ú<lambda>Ú(_NodeReporter.finalize.<locals>.<lambda>  s   ø€ ™dr   )r|   Ú__dict__Úclear)rK   r‚   s    @r   ÚfinalizeÚ_NodeReporter.finalizeý   s'   ø€ Ø�{‰{‹}ˆØ�‰×ÑÔô #ˆ�r   )	rF   rJ   rH   rG   rD   r   rI   r|   rE   )rL   zstr | TestReportrE   r   r   ÚNone)rR   ú
ET.Elementr   rÙ   ©r7   r   rV   Úobjectr   rÙ   ©r   zET.Element | None)rp   r   r   rÙ   )r   rÚ   r&   )rP   r   r   r   r‚   ú
str | Noner   rÙ   ©r•   r   r   rÙ   )r¡   r   r¢   r   r   r   )r•   r   r¡   r   r¥   r   r   rÙ   ©r   rÙ   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rM   rQ   rW   rZ   rc   rv   r|   rƒ   rš   r“   r”   r©   r²   r¶   r¹   rÁ   rÎ   r×   Ú__static_attributes__rÒ   r   r   r@   r@   V   sc   † ô(ô ôCô6ôô ô<öô
Cô.@ôô
!ôGô Nô
PôMô/÷,#r   r@   c                óð   • SSK Jn  U R                  R                  R	                  [
        S5      nUbC  UR                  S;  a2  U R                  R                  U" U SUR                   S35      5        ggg)z[Emit a PytestWarning about the given fixture being incompatible with newer xunit revisions.r   )ÚPytestWarningN)r=   Úlegacyz$ is incompatible with junit_family 'z' (use 'legacy' or 'xunit1'))	Ú_pytest.warning_typesrç   ÚconfigÚstashÚgetÚxml_keyrG   rR   Úwarn)ÚrequestÚfixture_namerç   rE   s       r   Ú!_warn_incompatibility_with_xunit2rñ     sl   € õ 4à
�.‰.×
Ñ
×
"Ñ
"¤7¨DÓ
1€CØ
�˜3Ÿ:™:Ð-AÓAØ�‰×ÑÙØ�.Ð DÀSÇZÁZÀLÐPlÐmóõ	
ð B€r   c                ó0   ^ • [        T S5        SU 4S jjnU$ )aN  Add extra properties to the calling test.

User properties become part of the test report and are available to the
configured reporters, like JUnit XML.

The fixture is callable with ``name, value``. The value is automatically
XML-encoded.

Example::

    def test_function(record_property):
        record_property("example_key", 1)
Úrecord_propertyc                óR   >• TR                   R                  R                  X45        g r&   )rR   Úuser_propertiesrQ   )r7   rV   rï   s     €r   Úappend_propertyÚ(record_property.<locals>.append_property%  s   ø€ Ø�‰×$Ñ$×+Ñ+¨T¨MÕ:r   rÛ   )rñ   )rï   rö   s   ` r   ró   ró     s   ø€ ô & gÐ/@ÔA÷;ð Ðr   c                ó6  • SSK Jn  U R                  R                  U" S5      5        [	        U S5        SS jnUnU R
                  R                  R                  [        S5      nUb1  UR                  U R                  R                  5      nUR                  nU$ )z‘Add extra xml attributes to the tag for the calling test.

The fixture is callable with ``name, value``. The value is
automatically XML-encoded.
r   )ÚPytestExperimentalApiWarningz/record_xml_attribute is an experimental featureÚrecord_xml_attributec                ó   • g r&   rÒ   r_   s     r   Úadd_attr_noopÚ+record_xml_attribute.<locals>.add_attr_noop;  s   € Ør   NrÛ   )ré   rù   rR   rî   rñ   rê   rë   rì   rí   Únode_reporterrL   rZ   )rï   rù   rü   Ú	attr_funcrE   rþ   s         r   rú   rú   +  sˆ   € õ Cà‡L�L×ÑÙ$Ð%VÓWôô & gÐ/EÔFôð €Ià
�.‰.×
Ñ
×
"Ñ
"¤7¨DÓ
1€CØ
�Ø×)Ñ)¨'¯,©,×*=Ñ*=Ó>ˆØ!×/Ñ/ˆ	àÐr   c                óŽ   • Sn[        U[        5      (       d.  Sn[        UR                  U [	        U5      R
                  S95      eg)z_Used by record_testsuite_property to check that the given parameter name is of the proper
type.Tz5{param} parameter needs to be a string, but {g} given)ÚparamÚgN)r(   r   r*   Úformatr+   rá   )r  ÚvÚ__tracebackhide__rÀ   s       r   Ú_check_record_param_typer  H  sC   € ð ÐÜ�aœ×ÑØEˆÜ˜Ÿ
™
¨´$°q³'×2BÑ2B˜
ÐCÓDÐDð r   Úsession)Úscopec                ó†   • SnSS jnU R                   R                  R                  [        S5      nUb  UR                  nU$ )aë  Record a new ``<property>`` tag as child of the root ``<testsuite>``.

This is suitable to writing global information regarding the entire test
suite, and is compatible with ``xunit2`` JUnit family.

This is a ``session``-scoped fixture which is called with ``(name, value)``. Example:

.. code-block:: python

    def test_foo(record_testsuite_property):
        record_testsuite_property("ARCH", "PPC")
        record_testsuite_property("STORAGE_TYPE", "CEPH")

:param name:
    The property name.
:param value:
    The property value. Will be converted to a string.

.. warning::

    Currently this fixture **does not work** with the
    `pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See
    :issue:`7767` for details.
Tc                ó    • Sn[        SU 5        g)zFNo-op function in case --junit-xml was not passed in the command-line.Tr7   N)r  )r7   rV   r  s      r   Úrecord_funcÚ.record_testsuite_property.<locals>.record_funcm  s   € à ÐÜ  ¨Õ.r   NrÛ   )rê   rë   rì   rí   Úadd_global_property)rï   r  r  rE   s       r   Úrecord_testsuite_propertyr  Q  sC   € ð4 Ðô/ð
 �.‰.×
Ñ
×
"Ñ
"¤7¨DÓ
1€CØ
�Ø×-Ñ-ˆØÐr   c                óT  • U R                  S5      nUR                  SSSSS[        R                  " [        SS9S SS	9  UR                  S
SSSS SS9  U R                  SSSS9  U R                  SSSS9  U R                  SSSSS9  U R                  SSSS9  U R                  SSS S9  g )!Nzterminal reportingz
--junitxmlz--junit-xmlÚstoreÚxmlpathÚpath)Úoptnamez0Create junit-xml style report file at given path)ÚactionÚdestÚmetavarr+   ÚdefaultÚhelpz--junitprefixz--junit-prefixr   z0Prepend prefix to classnames in junit-xml output)r  r  r  r  Újunit_suite_namez Test suite name for JUnit reportÚpytest)r  Újunit_loggingz\Write captured log messages to JUnit report: one of no|log|system-out|system-err|out-err|allr†   Újunit_log_passing_testsz;Capture log information for passing tests to JUnit report: ÚboolT)r+   r  Újunit_duration_reportz*Duration time to report: one of total|callÚtotalÚjunit_familyz0Emit XML for schema: one of legacy|xunit1|xunit2r>   )ÚgetgroupÚ	addoptionÚ	functoolsÚpartialr
   Úaddini)Úparserr   s     r   Úpytest_addoptionr'  x  sü   € Ø�O‰OÐ0Ó1€EØ	‡O�OØØØØØÜ×Òœ|°\ÑBØØ?ð ñ 	ð 
‡O�OØØØØØØ?ð ñ ð ‡M�MØÐ>Èð ñ ð ‡M�MØð	:àð	 ñ ð ‡M�MØ!ØEØØð	 ñ ð ‡M�MØØ4Øð ñ ð
 ‡M�MØØ:Øð ò r   c                óÂ  • U R                   R                  nU(       aÂ  [        U S5      (       d°  U R                  S5      n[	        UU R                   R
                  U R                  S5      U R                  S5      U R                  S5      UU R                  S5      5      U R                  [        '   U R                  R                  U R                  [           5        g g g )NÚworkerinputr   r  r  r  r  )
Úoptionr  rn   Úgetinir   Újunitprefixrë   rí   ÚpluginmanagerÚregister)rê   r  r   s      r   Úpytest_configurer/  §  s­   € Ø�m‰m×#Ñ#€Gæ”w˜v }×5Ñ5Ø—}‘} ^Ó4ˆÜ &ØØ�M‰M×%Ñ%Ø�M‰MÐ,Ó-Ø�M‰M˜/Ó*Ø�M‰MÐ1Ó2ØØ�M‰MÐ3Ó4ó!
ˆ�‰”WÑð 	×Ñ×%Ñ% f§l¡l´7Ñ&;Õ<ð 6€wr   c                ó¬   • U R                   R                  [        S 5      nU(       a-  U R                   [        	 U R                  R	                  U5        g g r&   )rë   rì   rí   r-  Ú
unregister)rê   rE   s     r   Úpytest_unconfigurer2  ¸  s@   € Ø
�,‰,×
Ñ
œ7 DÓ
)€CÞ
Ø�L‰LœÐ!Ø×Ñ×'Ñ'¨Õ,ð r   c                óö   • U R                  S5      u  pnUR                  S5      nUS   R                  [        R                  S5      US'   [
        R                  " SSUS   5      US'   US==   X#-   -  ss'   U$ )NÚ[z::r   rg   z\.py$r‡   rf   )Ú	partitionÚsplitÚreplacer   ÚSEPr    r!   )Úaddressr  Úpossible_open_bracketÚparamsrq   s        r   ri   ri   ¿  st   € Ø*1×*;Ñ*;¸CÓ*@Ñ'€D Ø�J‰J�tÓ€Eà�Q‰x×Ñ¤§	¡	¨3Ó/€Eˆ!�HÜ�vŠv�h  E¨!¡HÓ-€Eˆ!�Hà	ˆ"ƒIÐ&Ñ/Ñ/ƒIØ€Lr   c                  óÐ   • \ rS rSr     S           SS jjrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jr      SS jrSS jrSS jrSrg)r   iÊ  c                óö  • [         R                  R                  [         R                  R                  U5      5      n[         R                  R	                  [         R                  R                  U5      5      U l        X l        X0l        X@l	        Xpl
        XPl        X`l        [        R                  / SQS5      U l        0 U l        / U l        / U l        / U l        SU l        U R                  S:X  a  SU l        g g )N)rµ   rŽ   r¯   r­   r   rè   r=   )Úosr  Ú
expanduserÚ
expandvarsÚnormpathÚabspathÚlogfilerj   Ú
suite_namer’   r�   Úreport_durationrG   ÚdictÚfromkeysÚstatsÚnode_reportersÚnode_reporters_orderedÚglobal_propertiesÚopen_reportsÚcnt_double_fail_tests)rK   rC  rj   rD  r’   rE  rG   r�   s           r   rM   ÚLogXML.__init__Ë  sÇ   € ô —'‘'×$Ñ$¤R§W¡W×%7Ñ%7¸Ó%@ÓAˆÜ—w‘w×'Ñ'¬¯©¯©¸Ó(@ÓAˆŒØŒØ$ŒØŒØ!2ÔØ.ÔØŒÜ%)§]¡]Ú5°qó&
ˆŒ
ð UWˆÔØ;=ˆÔ#Ø8:ˆÔð /1ˆÔØ%&ˆÔ"ð �;‰;˜(Ó"Ø"ˆD�Kð #r   c                óø   • [        USU5      n[        USS 5      nU R                  R                  X#45      nUR                   H   u  pVUR	                  U[        U5      5        M"     Ub  UR                  5         g g ©NrL   rR   )r±   rI  Úpoprõ   rW   r   r×   )rK   r•   rL   Ú
workernodeÚreporterÚpropnameÚ	propvalues          r   r×   ÚLogXML.finalizeì  sw   € Ü˜ ¨6Ó2ˆä˜V V¨TÓ2ˆ
Ø×&Ñ&×*Ñ*¨FÐ+?Ó@ˆà#)×#9Ô#9ÑˆHØ×!Ñ! (¬C°	«NÖ;ñ $:ð ÑØ×ÑÕð  r   c                óä   • [        USU5      n[        USS 5      nX#4nX@R                  ;   a  U R                  U   $ [        X 5      nXPR                  U'   U R                  R	                  U5        U$ rP  )r±   rI  r@   rJ  rQ   )rK   r•   rL   rR  ru   rS  s         r   rþ   ÚLogXML.node_reporterø  st   € Ü#*¨6°8¸VÓ#Dˆä˜V V¨TÓ2ˆ
àÐ ˆà×%Ñ%Ó%à×&Ñ& sÑ+Ð+ä  Ó.ˆà#+×Ñ˜CÑ Ø×#Ñ#×*Ñ*¨8Ô4àˆr   c                óR   • XR                   ;   a  U R                   U==   S-  ss'   g g )Nrh   )rH  )rK   ru   s     r   rF   ÚLogXML.add_stats
  s#   € Ø—*‘*ÓØ�J‰J�s‹O˜qÑ ŒOð r   c                óJ   • U R                  U5      nUR                  U5        U$ r&   )rþ   rv   ©rK   r•   rS  s      r   Ú_opentestcaseÚLogXML._opentestcase  s%   € Ø×%Ñ% fÓ-ˆØ×"Ñ" 6Ô*Øˆr   c                ó~  ^^^• SnTR                   (       a4  TR                  S:X  a"  U R                  T5      nUR                  T5        GO?TR                  (       aû  TR                  S:X  ai  [        TSS5      m[        TSS5      m[        UUU4S jU R                   5       S5      nU(       a&  U R                  U5        U =R                  S-  sl	        U R                  T5      nTR                  S:X  aO  UR                  T5        U R                  R                  T5        U R                  (       d  UR                  T5        OEUR                  T5        O3TR                  (       a"  U R                  T5      nUR!                  T5        U R#                  T5        TR                  S:X  a“  U R                  T5      nUR                  T5        U R                  T5        [        TSS5      m[        TSS5      m[        UUU4S jU R                   5       S5      nU(       a  U R                  R%                  U5        ggg)	aï  Handle a setup/call/teardown report, generating the appropriate
XML tags as necessary.

Note: due to plugins like xdist, this hook may be called in interlaced
order with reports from other nodes. For example:

Usual call order:
    -> setup node1
    -> call node1
    -> teardown node1
    -> setup node2
    -> call node2
    -> teardown node2

Possible call order in xdist:
    -> setup node1
    -> call node1
    -> setup node2
    -> call node2
    -> teardown node2
    -> teardown node1
NÚcallr¼   Ú	worker_idÚ
item_indexc              3  ó¬   >#   • U  HI  nUR                   TR                   :X  d  M  [        US S5      T:X  d  M2  [        USS5      T:X  d  ME  Uv •  MK     g7f©rb  Nra  ©rL   r±   ©Ú.0Úrepr•   Ú	report_iiÚ
report_wids     €€€r   Ú	<genexpr>Ú2LogXML.pytest_runtest_logreport.<locals>.<genexpr>5  sZ   øé € ð â#4˜CàŸJ™J¨&¯-©-Ñ7ó ô !(¨¨\¸4Ó @ÀIÑ Mó	 ô
 !(¨¨[¸$Ó ?À:Ñ M÷ ™Ú#4ùó   ƒA¥A¸AÁ	Arh   c              3  ó¬   >#   • U  HI  nUR                   TR                   :X  d  M  [        US S5      T:X  d  M2  [        USS5      T:X  d  ME  Uv •  MK     g7frd  re  rf  s     €€€r   rk  rl  Z  sZ   øé € ð â0˜àŸ
™
 f§m¡mÑ3ó ô $ C¨°tÓ<À	ÑIó	 ô
 $ C¨°dÓ;¸zÑI÷ ‘CÚ0ùrm  )rŽ   r¾   r]  r©   Úfailedr±   ÚnextrL  r×   rM  r²   rQ   r�   rš   rÁ   r­   rÎ   Úupdate_testcase_durationÚremove)rK   r•   Úclose_reportrS  ri  rj  s    `  @@r   Úpytest_runtest_logreportÚLogXML.pytest_runtest_logreport  sß  ú€ ð. ˆØ�=�=Ø�{‰{˜fÓ$Ø×-Ñ-¨fÓ5�Ø×$Ñ$ VÔ,ùØ�]�]Ø�{‰{˜jÓ(ä$ V¨[¸$Ó?�
Ü# F¨L¸$Ó?�	Ü#öà#'×#4Ò#4óð ó �ö  ð —M‘M ,Ô/Ø×.Ò.°!Ñ3Õ.Ø×)Ñ)¨&Ó1ˆHØ�{‰{˜fÓ$Ø×'Ñ'¨Ô/Ø×!Ñ!×(Ñ(¨Ô0Ø×-×-Ø×2Ñ2°6Ô:øà×%Ñ% fÕ-Ø�^�^Ø×)Ñ)¨&Ó1ˆHØ×#Ñ# FÔ+Ø×%Ñ% fÔ-Ø�;‰;˜*Ó$Ø×)Ñ)¨&Ó1ˆHØ×*Ñ*¨6Ô2à�M‰M˜&Ô!Ü  ¨°dÓ;ˆJÜ ¨°dÓ;ˆIÜöà#×0Ò0óð óˆLö Ø×!Ñ!×(Ñ(¨Õ6ð ð' %r   c                ó    • U R                   SUR                  1;   a2  U R                  U5      nU=R                  [	        USS5      -  sl        gg)z{Accumulate total duration for nodeid from given report and update
the Junit.testcase with the new total if already created.r  rH   rC   N)rE  r¾   rþ   rH   r±   r\  s      r   rq  ÚLogXML.update_testcase_durationh  sJ   € ð ×Ñ G¨V¯[©[Ð#9Ó9Ø×)Ñ)¨&Ó1ˆHØ×Ò¤¨°¸SÓ!AÑAÖð :r   c                ó²   • UR                   (       dF  U R                  U5      nUR                  (       a  UR                  U5        g UR	                  U5        g g r&   )rŽ   r]  ro  r¶   r¹   r\  s      r   Úpytest_collectreportÚLogXML.pytest_collectreporto  sA   € Ø�}�}Ø×)Ñ)¨&Ó1ˆHØ�}�}Ø×-Ñ-¨fÕ5à×/Ñ/°Õ7ð r   c                ó’   • U R                  S5      nUR                  R                  SSS9  UR                  SS[	        U5      5        g )NÚinternalr  )r6   r7   rµ   zinternal error)rþ   rJ   r,   rƒ   r   )rK   ÚexcreprrS  s      r   Úpytest_internalerrorÚLogXML.pytest_internalerrorw  s@   € Ø×%Ñ% jÓ1ˆØ�‰×Ñ¨°zÐÑBØ×Ñ˜WÐ&6¼¸G»ÕEr   c                ó8   • [         R                  " 5       U l        g r&   )r   ÚInstantÚsuite_start)rK   s    r   Úpytest_sessionstartÚLogXML.pytest_sessionstart|  s   € Ü!Ÿ>š>Ó+ˆÕr   c                óô  • [         R                  R                  [         R                  R                  U R                  5      5      n[         R
                  " USS9  [        U R                  SSS9 nU R                  R                  5       nU R                  S   U R                  S   -   U R                  S   -   U R                  S	   -   U R                  -
  nUR                  S
5        [        R                  " SU R                  [        U R                  S	   5      [        U R                  S   5      [        U R                  S   5      [        U5      UR                   S U R                  R#                  5       R%                  5       R'                  5       [(        R*                  " 5       S9	nU R-                  5       nUb  UR/                  U5        U R0                   H"  nUR/                  UR3                  5       5        M$     [        R                  " S5      nUR5                  SS5        UR/                  U5        UR                  [        R6                  " USS95        S S S 5        g ! , (       d  f       g = f)NT)Úexist_okÚwzutf-8)ÚencodingrŽ   r¯   r­   rµ   z&<?xml version="1.0" encoding="utf-8"?>Ú	testsuitery   )r7   ÚerrorsÚfailuresr­   Útestsrz   Ú	timestampÚhostnameÚ
testsuitesr7   zpytest testsÚunicode)r>  r  ÚdirnamerB  rC  ÚmakedirsÚopenr‚  ÚelapsedrH  rM  Úwriter`   ra   rD  r   ÚsecondsÚas_utcÚ
astimezoneÚ	isoformatÚplatformrR   Ú_get_global_properties_noderQ   rJ  r|   ÚsetÚtostring)	rK   r‘  rC  rH   ÚnumtestsÚ
suite_noderK  rþ   r�  s	            r   Úpytest_sessionfinishÚLogXML.pytest_sessionfinish  sç  € Ü—'‘'—/‘/¤"§'¡'§/¡/°$·,±,Ó"?Ó@ˆä
�Š�G dÒ+ä�$—,‘, ¨gÒ6¸'Ø×'Ñ'×/Ñ/Ó1ˆHð —
‘
˜8Ñ$Ø—*‘*˜YÑ'ñ(à—*‘*˜YÑ'ñ(ð —*‘*˜WÑ%ñ&ð ×,Ñ,ñ	-ð ð �M‰MÐBÔCäŸšØØ—_‘_Ü˜4Ÿ:™: gÑ.Ó/Ü˜TŸZ™Z¨	Ñ2Ó3Ü˜DŸJ™J yÑ1Ó2Ü˜(“mØ ×(Ñ(¨Ð-Ø×*Ñ*×1Ñ1Ó3×>Ñ>Ó@×JÑJÓLÜ!Ÿš›ñ
ˆJð !%× @Ñ @Ó BÐØ Ñ,Ø×!Ñ!Ð"3Ô4Ø!%×!<Ô!<�Ø×!Ñ! -×"6Ñ"6Ó"8Ö9ñ "=äŸš LÓ1ˆJØ�N‰N˜6 >Ô2Ø×Ñ˜jÔ)Ø�M‰Mœ"Ÿ+š+ j¸9ÑEÔF÷? 7×6Ö6ús   Á1G/I)É)
I7c                ól   • UR                  5       S:¼  a   UR                  SSU R                   35        g g )Nr   rŸ   zgenerated xml file: )Úget_verbosityÚ	write_seprC  )rK   Úterminalreporterrê   s      r   Úpytest_terminal_summaryÚLogXML.pytest_terminal_summary¥  s6   € ð ×ÑÓ! QÓ&Ø×&Ñ& sÐ.BÀ4Ç<Á<À.Ð,QÕRð 'r   c                ól   • Sn[        SU5        U R                  R                  U[        U5      45        g )NTr7   )r  rK  rQ   r$   )rK   r7   rV   r  s       r   r  ÚLogXML.add_global_property«  s0   € Ø ÐÜ  ¨Ô.Ø×Ñ×%Ñ% t¬^¸EÓ-BÐ&CÕDr   c           	     óÈ   • U R                   (       aQ  [        R                  " S5      nU R                    H)  u  p#UR                  [        R                  " SX#S95        M+     U$ gr]   )rK  r`   ra   rQ   rb   s       r   r›  Ú"LogXML._get_global_properties_node°  sM   € à×!×!ÜŸš LÓ1ˆJØ#×5Ô5‘�Ø×!Ñ!¤"§*¢*¨Z¸dÑ"PÖQñ  6àÐØr   )rM  rG   rK  r�   rC  r’   rI  rJ  rL  rj   rE  rH  rD  r‚  N)r  r†   r  r=   T)rj   rÞ   rD  r   r’   r   rE  r   r�   r  r   rÙ   rß   )r•   zTestReport | strr   r@   )ru   r   r   rÙ   )r•   r   r   r@   )r}  r   r   rÙ   rà   )r¥  r   rê   zpytest.Configr   rÙ   rÛ   rÝ   )rá   râ   rã   rä   rM   r×   rþ   rF   r]  rt  rq  ry  r~  rƒ  r   r¦  r  r›  rå   rÒ   r   r   r   r   Ê  s¹   † ð
 #ØØ&ØØ"&ð#ð ð#ð ð	#ð
 ð#ð ð#ð  ð#ð 
õ#ôB
 ôô$!ôô
S7ôjBô8ôFô
,ô$GðLSØ 0ðSØ:GðSà	ôSôE÷
r   )r"   rÜ   r   r   rà   )rï   r   rð   r   r   rÙ   )rï   r   r   zCallable[[str, object], None])r  r   r  r   r   rÙ   )r&  r   r   rÙ   )rê   r	   r   rÙ   )r9  r   r   z	list[str])2Ú__doc__Ú
__future__r   Úcollections.abcr   r#  r>  rš  r    Úxml.etree.ElementTreeÚetreeÚElementTreer`   Ú_pytestr   r   Ú_pytest._code.coder   r   Ú_pytest.configr	   r
   Ú_pytest.config.argparsingr   Ú_pytest.fixturesr   Ú_pytest.reportsr   Ú_pytest.stashr   Ú_pytest.terminalr   r  rí   r$   r4   ro   Úcopyr@   rñ   Úfixtureró   rú   r  r  r'  r/  r2  ri   r   rÒ   r   r   Ú<module>r¼     s^  ðñõ #å $Û Û 	Û Û 	ß "Ð "å Ý Ý ,Ý /Ý !Ý 'Ý ,Ý +Ý &Ý "Ý -Û ð �8Ò
Ó
€ô2ô6ð ˜;¨Ð/Ð0ØÒ!8Ð9ñ€ð
 ˜gÑ&×+Ñ+Ó-€ˆÑ Ù ˆX�hÑ ¨.Ñ!9Ô :ð ˜gÑ&€ˆÑ ÷l#ñ l#ð^
Øð
Ø+.ð
à	ô
ð ‡�óó ðð, ‡�óó ðô8Eð ‡‚�iÑ ó#ó !ð#ôL,ô^=ô"-ô÷mò mr   