§
    øÛgjš  ã                   ó–  — 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Zddl	Z	ddl
m
Z
 ddlmZ ddlmZ ddlZddlZddlmZmZ ddlmZ d„ Zd	„ Z G d
„ de¦  «        ZddddddddœZi fd„Z ej        g d¢¬¦  «        d„ ¦   «         Zej        d„ ¦   «         Z G d„ d¦  «        Zd„ Z  G d„ d¦  «        Z! G d„ d¦  «        Z"ej        d „ ¦   «         Z# ej        d!¬"¦  «        d#„ ¦   «         Z$ej        d$„ ¦   «         Z% ej&        d%¦  «        Z' G d&„ d'¦  «        Z( G d(„ d)¦  «        Z)d*„ Z* G d+„ d,¦  «        Z+ G d-„ d!¦  «        Z,dS ).zF (disabled by default) support for testing pytest and pytest plugins. é    N)Úfnmatch)Úprint_)ÚSource)ÚSessionÚEXIT_OK)ÚAssertionRewritingHookc                 ón   — |                       ddddd¬¦  «         |                       ddd	d
d¬¦  «         d S )Nz--lsofÚ
store_trueÚlsofFz"run FD checks if lsof is available)ÚactionÚdestÚdefaultÚhelpú--runpytestÚ	inprocessÚ	runpytest)r   Ú
subprocesszYrun pytest sub runs in tests using an 'inprocess' or 'subprocess' (python -m main) method)r   r   Úchoicesr   )Ú	addoption)Úparsers    úF/granary/edev/quantum/lib/python3.11/site-packages/_pytest/pytester.pyÚpytest_addoptionr      sb   € à
×Ò�XØ V°UØ5ð ñ 8ô 8ð 8ð ×Ò�]¨K¸kØ0ð;ð ñ =ô =ð =ð =ð =ó    c                 ó�  — 	 t            ng# t          $ rZ t          j                             t
          j                             d¦  «        ¦  «        a t                                dd¦  «        a Y nw xY w|  	                    d¦  «        r>t          ¦   «         }|                     ¦   «         r| j                             |¦  «         d S d S d S )NÚocz	$py.classú.pyr   )Ú_pytest_fullpathÚ	NameErrorÚosÚpathÚabspathÚpytestÚ__file__ÚrstripÚreplaceÚgetvalueÚLsofFdLeakCheckerÚmatching_platformÚpluginmanagerÚregister)ÚconfigÚcheckers     r   Úpytest_configurer-   "   sÖ   € ðHÝÐÐøÝð Hð Hð HÝœ7Ÿ?š?­6¬?×+AÒ+AÀ$Ñ+GÔ+GÑHÔHÐÝ+×3Ò3°KÀÑGÔGÐÐÐðHøøøð ‡‚�vÑÔð 3Ý#Ñ%Ô%ˆØ×$Ò$Ñ&Ô&ð 	3ØÔ ×)Ò)¨'Ñ2Ô2Ð2Ð2Ð2ð3ð 3ð	3ð 	3s   ‚
 ŠA!A.Á-A.c                   ó\   — e Zd Zd„ Zd„ Zd„ Zd„ Z ej        dd¬¦  «        d„ ¦   «         Z	dS )	r'   c                 óX   — |                       ¦   «         }|                      |¦  «        }|S ©N)Ú
_exec_lsofÚ_parse_lsof_output)ÚselfÚoutÚ
open_filess      r   Úget_open_filesz LsofFdLeakChecker.get_open_files2   s*   € Ø�oŠoÑÔˆØ×,Ò,¨SÑ1Ô1ˆ
ØÐr   c                 ól   — t          j        ¦   «         }t          j                             d|z  ¦  «        S )Nzlsof -Ffn0 -p %d)r   ÚgetpidÚpyÚprocessÚcmdexec)r3   Úpids     r   r1   zLsofFdLeakChecker._exec_lsof7   s)   € ÝŒi‰kŒkˆÝŒz×!Ò!Ð"4°sÑ":Ñ;Ô;Ð;r   c                 ó  — d„ }g }|                      d¦  «        D ]n} ||¦  «        ra|                      d¦  «        }|d         dd …         }|d         dd …         }|                     d¦  «        r|                     ||f¦  «         Œo|S )Nc                 óL   — |                       d¦  «        od| vod| vod| vod| vS )NÚfÚdeletedÚmemÚtxtÚcwd)Ú
startswith)Úlines    r   Úisopenz4LsofFdLeakChecker._parse_lsof_output.<locals>.isopen<   sN   € Ø—?’? 3Ñ'Ô'ð O¨Y¸dÐ-Bð .NØ˜TÐ!ð.NØ&+°4Ð&7ð.NØ<AÈÐ<MðOr   ú
ú r   é   ú/)ÚsplitrD   Úappend)r3   r4   rF   r5   rE   ÚfieldsÚfdÚfilenames           r   r2   z$LsofFdLeakChecker._parse_lsof_output;   s¬   € ð	Oð 	Oð 	Oð ˆ
à—I’I˜d‘O”Oð 	6ð 	6ˆDØˆv�d‰|Œ|ð 6ØŸš DÑ)Ô)�Ø˜A”Y˜q˜r˜r”]�Ø! !œ9 Q R Rœ=�Ø×&Ò& sÑ+Ô+ð 6Ø×%Ò% r¨8 nÑ5Ô5Ð5øàÐr   c                 ó”   — 	 t           j                             d¦  «         dS # t           j        j        j        t          f$ r Y dS w xY w)Nzlsof -vTF)r9   r:   r;   ÚErrorÚUnicodeDecodeError©r3   s    r   r(   z#LsofFdLeakChecker.matching_platformL   sX   € ð	ÝŒJ×Ò˜yÑ)Ô)Ð)ð �4øõ ”
Ô"Ô(Õ*<Ð=ð 	ð 	ð 	ð �5�5ð		øøøs   ‚# £ AÁAT)ÚhookwrapperÚtryfirstc              #   ó^  ‡K  — |                       ¦   «         }d V — t          t          d¦  «        rt          j        ¦   «          |                       ¦   «         }t          d„ |D ¦   «         ¦  «        t          d„ |D ¦   «         ¦  «        z
  Šˆfd„|D ¦   «         }|�rg }|                     dt          |¦  «        z  ¦  «         |                     d„ |D ¦   «         ¦  «         |                     d¦  «         |                     d„ |D ¦   «         ¦  «         |                     d	¦  «         |                     d
„ |D ¦   «         ¦  «         |                     |d         ¦  «         |                     d|j	        z  ¦  «         t          j        d                     |¦  «        d¬¦  «         d S d S )NÚpypy_version_infoc                 ó   — g | ]
}|d          ‘ŒS ©r   © ©Ú.0Úts     r   ú
<listcomp>z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>_   s   € Ð,Ð,Ð, �q˜”tÐ,Ð,Ð,r   c                 ó   — g | ]
}|d          ‘ŒS rY   rZ   r[   s     r   r^   z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>_   s   € Ð4JÐ4JÐ4J¸a°Q°q´TÐ4JÐ4JÐ4Jr   c                 ó(   •— g | ]}|d          ‰v ¯|‘ŒS rY   rZ   )r\   r]   Únew_fdss     €r   r^   z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>`   s"   ø€ Ð=Ð=Ð=˜a¨Q¨q¬T°W¨_¨_˜¨_¨_¨_r   z***** %s FD leakage detectedc                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   ©Ústr©r\   r?   s     r   r^   z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>d   s   € Ð7Ð7Ð7 Q�#˜a™&œ&Ð7Ð7Ð7r   z*** Before:c                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   rc   re   s     r   r^   z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>f   ó   € Ð1Ð1Ð1 Q�#˜a™&œ&Ð1Ð1Ð1r   z
*** After:c                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   rc   re   s     r   r^   z9LsofFdLeakChecker.pytest_runtest_item.<locals>.<listcomp>h   rg   r   r   z*** function %s:%s: %s rG   F)Úpytrace)r6   ÚhasattrÚsysÚgcÚcollectÚsetrL   ÚlenÚextendÚlocationr"   ÚfailÚjoin)r3   ÚitemÚlines1Úlines2Úleaked_filesÚerrorra   s         @r   Úpytest_runtest_itemz%LsofFdLeakChecker.pytest_runtest_itemW   s¶  øè è € à×$Ò$Ñ&Ô&ˆØˆˆˆÝ•3Ð+Ñ,Ô,ð 	ÝŒJ‰LŒLˆLØ×$Ò$Ñ&Ô&ˆåÐ,Ð, VÐ,Ñ,Ô,Ñ-Ô-µÐ4JÐ4JÀ6Ð4JÑ4JÔ4JÑ0KÔ0KÑKˆØ=Ð=Ð=Ð= 6Ð=Ñ=Ô=ˆØñ 
	9ØˆEØ�LŠLÐ7½#¸lÑ:KÔ:KÑKÑLÔLÐLØ�LŠLÐ7Ð7¨,Ð7Ñ7Ô7Ñ8Ô8Ð8Ø�LŠL˜Ñ'Ô'Ð'Ø�LŠLÐ1Ð1¨&Ð1Ñ1Ô1Ñ2Ô2Ð2Ø�LŠL˜Ñ&Ô&Ð&Ø�LŠLÐ1Ð1¨&Ð1Ñ1Ô1Ñ2Ô2Ð2Ø�LŠL˜˜qœÑ"Ô"Ð"Ø�LŠLÐ2°T´]ÑBÑCÔCÐCÝŒK˜Ÿ	š	 %Ñ(Ô(°%Ð8Ñ8Ô8Ð8Ð8Ð8ð
	9ð 
	9r   N)
Ú__name__Ú
__module__Ú__qualname__r6   r1   r2   r(   r"   Úhookimplry   rZ   r   r   r'   r'   1   s}   € € € € € ðð ð ð
<ð <ð <ðð ð ð"	ð 	ð 	ð €V„_ °Ð5Ñ5Ô5ð9ð 9ñ 6Ô5ð9ð 9ð 9r   r'   zC:\Python27\python.exezC:\Python26\python.exezC:\Python31\python.exezC:\Python32\python.exezC:\Python33\python.exezC:\Python34\python.exezC:\Python35\python.exe)ú	python2.7ú	python2.6z	python3.1z	python3.2ú	python3.3ú	python3.4z	python3.5c                 óV  — 	 ||          S # t           $ r” t          j        j                             | ¦  «        }|rddd l} |j        t          |¦  «        dgd|j        ¬¦  «        }| 	                    ¦   «         \  }}| dk    r|rd|vrd }d|v rd }n|j
        dk    rd }||| <   |cY S w xY w)Nr   z	--versionT)Úuniversal_newlinesÚstderrÚjythonz2.5z2.5.2)ÚKeyErrorr9   r    ÚlocalÚsysfindr   ÚPopenrd   ÚPIPEÚcommunicateÚ
returncode)ÚnameÚcacheÚ
executabler   Úpopenr4   Úerrs          r   Úgetexecutabler’   y   sõ   € ðØ�TŒ{ÐøÝð ð ð Ý”W”]×*Ò*¨4Ñ0Ô0ˆ
Øð 	"ØÐÐÐØ$�JÔ$¥c¨*¡o¤o°{Ð%CØ#'°
´ðAñ Aô AˆEà×(Ò(Ñ*Ô*‰HˆC�Ø�xÒÐØð &˜e¨3Ð.Ð.Ø!%�JØ˜c�>�>Ø!%�JøØÔ! QÒ&Ð&à!�
Ø ˆˆd‰ØÐÐÐð!øøøs   ‚
 ŠBB(Â'B()r   r~   r€   r�   ÚpypyÚpypy3)Úparamsc                 ó*  — | j         }t          |¦  «        }|€zt          j        dk    rRt                               |d ¦  «        }|r5t          j                             |¦  «        }| 	                    ¦   «         r|S t          j        d|›d�¦  «         |S )NÚwin32zno suitable z found)Úparamr’   rk   ÚplatformÚwinpymapÚgetr9   r    r‡   Úcheckr"   Úskip)Úrequestr�   r�   s      r   Ú	anypythonrŸ   Ž   s’   € ð Œ=€DÝ˜tÑ$Ô$€JØÐÝŒ<˜7Ò"Ð"Ý!Ÿš d¨DÑ1Ô1ˆJØð &ÝœWŸ]š]¨:Ñ6Ô6�
Ø×#Ò#Ñ%Ô%ð &Ø%Ð%ÝŒˆ¨d¨d¨dÐ4Ñ5Ô5Ð5ØÐr   c                 ó    — t          | ¦  «        S )z¢ Return a helper which offers a gethookrecorder(hook)
    method which returns a HookRecorder instance which helps
    to make assertions about called hooks.
    )Ú	PytestArg©rž   s    r   Ú_pytestr£   ž   s   € õ �WÑÔÐr   c                   ó   — e Zd Zd„ Zd„ ZdS )r¡   c                 ó   — || _         d S r0   r¢   )r3   rž   s     r   Ú__init__zPytestArg.__init__§   s   € ØˆŒˆˆr   c                 ól   — t          |j        ¦  «        }| j                             |j        ¦  «         |S r0   )ÚHookRecorderÚ_pmrž   ÚaddfinalizerÚfinish_recording)r3   ÚhookÚhookrecorders      r   ÚgethookrecorderzPytestArg.gethookrecorderª   s0   € Ý# D¤HÑ-Ô-ˆØŒ×!Ò! ,Ô"?Ñ@Ô@Ð@ØÐr   N)rz   r{   r|   r¦   r®   rZ   r   r   r¡   r¡   ¦   s2   € € € € € ðð ð ðð ð ð ð r   r¡   c                 ó   — d„ | D ¦   «         S )z?Only return names from iterator l without a leading underscore.c                 ó*   — g | ]}|d          dk    ¯|‘ŒS )r   Ú_rZ   ©r\   Úxs     r   r^   z$get_public_names.<locals>.<listcomp>²   s!   € Ð(Ð(Ð(�!˜A˜aœD CšK˜KˆA˜K˜K˜Kr   rZ   )Úls    r   Úget_public_namesrµ   °   s   € à(Ð(�qÐ(Ñ(Ô(Ð(r   c                   ó   — e Zd Zd„ Zd„ ZdS )Ú
ParsedCallc                 óH   — | j                              |¦  «         || _        d S r0   )Ú__dict__ÚupdateÚ_name)r3   r�   Úkwargss      r   r¦   zParsedCall.__init__¶   s#   € ØŒ×Ò˜VÑ$Ô$Ð$ØˆŒ
ˆ
ˆ
r   c                 óV   — | j                              ¦   «         }|d= d| j        ›d|›d�S )Nr»   z<ParsedCall z(**z)>)r¹   Úcopyr»   )r3   Úds     r   Ú__repr__zParsedCall.__repr__º   s3   € ØŒM×ÒÑ Ô ˆØˆgˆJˆJØ)-¬¨¨°Q°Q°QÐ7Ð7r   N)rz   r{   r|   r¦   rÀ   rZ   r   r   r·   r·   µ   s2   € € € € € ðð ð ð8ð 8ð 8ð 8ð 8r   r·   c                   óv   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z		 dd	„Z
	 	 dd„Z	 dd„Zd„ Zd„ Zd„ Zdd„Zd„ ZdS )r¨   z©Record all hooks called in a plugin manager.

    This wraps all the hook calls in the plugin manager, recording
    each call before propagating the normal calls.

    c                 ój   ‡ — |‰ _         g ‰ _        ˆ fd„}d„ }|                     ||¦  «        ‰ _        d S )Nc                 óX   •— ‰j                              t          | |¦  «        ¦  «         d S r0   )ÚcallsrL   r·   )Ú	hook_nameÚ
hook_implsr¼   r3   s      €r   Úbeforez%HookRecorder.__init__.<locals>.beforeÌ   s)   ø€ ØŒJ×Ò�j¨°FÑ;Ô;Ñ<Ô<Ð<Ð<Ð<r   c                 ó   — d S r0   rZ   )ÚoutcomerÅ   rÆ   r¼   s       r   Úafterz$HookRecorder.__init__.<locals>.afterÏ   s   € ØˆDr   )Ú_pluginmanagerrÄ   Úadd_hookcall_monitoringÚ_undo_wrapping)r3   r)   rÇ   rÊ   s   `   r   r¦   zHookRecorder.__init__È   sZ   ø€ Ø+ˆÔØˆŒ
ð	=ð 	=ð 	=ð 	=ð 	=ð	ð 	ð 	ð ,×CÒCÀFÈEÑRÔRˆÔÐÐr   c                 ó.   — |                       ¦   «          d S r0   )rÍ   rS   s    r   r«   zHookRecorder.finish_recordingÔ   s   € Ø×ÒÑÔÐÐÐr   c                 ó|   ‡— t          ‰t          ¦  «        r‰                     ¦   «         Šˆfd„| j        D ¦   «         S )Nc                 ó&   •— g | ]}|j         ‰v ¯|‘ŒS rZ   )r»   )r\   ÚcallÚnamess     €r   r^   z)HookRecorder.getcalls.<locals>.<listcomp>Ú   s%   ø€ ÐCÐCÐC˜¨t¬z¸UÐ/BÐ/B�Ð/BÐ/BÐ/Br   )Ú
isinstancerd   rK   rÄ   ©r3   rÒ   s    `r   ÚgetcallszHookRecorder.getcalls×   s>   ø€ Ý�e�SÑ!Ô!ð 	"Ø—K’K‘M”MˆEØCÐCÐCÐC ¤ÐCÑCÔCÐCr   c                 ó.  — d}d}t          |¦  «        }t          j        d¦  «        j        }|ræ|                     d¦  «        \  }}t          | j        |d …         ¦  «        D ]“\  }}|j        |k    rqt          d||¦  «         t          |||j
        ¦  «        r t          dt          |¦  «        d|¦  «         n t          dt          |¦  «        d|¦  «         Œw||dz   z  } n-t          d	|d
|¦  «         Œ”t          j        d|›d|›�¦  «         |°äd S d S )NTr   rI   Ú	NAMEMATCHÚCHECKERMATCHz->ÚNOCHECKERMATCHú-ÚNONAMEMATCHÚwithzcould not find z check )Úlistrk   Ú	_getframeÚf_localsÚpopÚ	enumeraterÄ   r»   r   Úevalr¹   Úreprr"   rr   )	r3   ÚentriesÚ__tracebackhide__ÚiÚ
backlocalsr�   rœ   ÚindrÑ   s	            r   Úassert_containszHookRecorder.assert_containsÜ   sF  € Ø ÐØˆÝ�w‘-”-ˆÝ”] 1Ñ%Ô%Ô.ˆ
Øð 	JØ!Ÿ+š+ a™.œ.‰KˆD�%Ý& t¤z°!°"°"¤~Ñ6Ô6ð Jð J‘	��TØ”: Ò%Ð%Ý˜;¨¨dÑ3Ô3Ð3Ý˜E :¨t¬}Ñ=Ô=ð !Ý˜~­t°E©{¬{¸DÀ$ÑGÔGÐGÐGåÐ/µ°e±´¸cÀ4ÑHÔHÐHØ Ø˜˜q™‘L�AØ�EÝ�} d¨F°DÑ9Ô9Ð9Ð9å”�¸D¸D¸DÀ%À%ÐHÑIÔIÐIð ð 	Jð 	Jð 	Jð 	Jð 	Jr   c                 ó  — d}t          | j        ¦  «        D ]\  }}|j        |k    r| j        |= |c S Œd|›d�g}|                     d„ | j        D ¦   «         ¦  «         t	          j        d                     |¦  «        ¦  «         d S )NTzcould not find call z, in:c                 ó2   — g | ]}d t          |¦  «        z  ‘ŒS )z  %src   r²   s     r   r^   z(HookRecorder.popcall.<locals>.<listcomp>ø   s"   € Ð:Ð:Ð:¨!�f�s 1™vœv‘oÐ:Ð:Ð:r   rG   )rá   rÄ   r»   rp   r"   rr   rs   )r3   r�   rå   ræ   rÑ   Úliness         r   ÚpopcallzHookRecorder.popcallñ   s¤   € Ø ÐÝ  ¤Ñ,Ô,ð 	ð 	‰GˆAˆtØŒz˜TÒ!Ð!Ø”J˜q�MØ���ð "ð	ð 37°$°$Ð8Ð9ˆØ�ŠÐ:Ð:¨t¬zÐ:Ñ:Ô:Ñ;Ô;Ð;ÝŒ�D—I’I˜eÑ$Ô$Ñ%Ô%Ð%Ð%Ð%r   c                 óz   — |                       |¦  «        }t          |¦  «        dk    sJ ||f¦   «         ‚|d         S )NrI   r   )rÕ   ro   )r3   r�   r´   s      r   ÚgetcallzHookRecorder.getcallû   s9   € Ø�MŠM˜$ÑÔˆÝ�1‰vŒv˜Š{ˆ{ˆ{˜T 1˜I‰{Œ{ˆ{Ø�Œtˆr   ú-pytest_runtest_logreport pytest_collectreportc                 ó@   — d„ |                       |¦  «        D ¦   «         S )Nc                 ó   — g | ]	}|j         ‘Œ
S rZ   )Úreportr²   s     r   r^   z+HookRecorder.getreports.<locals>.<listcomp>  s   € Ð7Ð7Ð7˜Q�”Ð7Ð7Ð7r   )rÕ   rÔ   s     r   Ú
getreportszHookRecorder.getreports  s"   € à7Ð7 $§-¢-°Ñ"6Ô"6Ð7Ñ7Ô7Ð7r   Ú Nc                 ó¦  — g }|                       |¬¦  «        D ]t}	 |s|j        dk    r|j        rŒn# t          $ r Y nw xY w|rt	          |dd¦  «        |k    rŒA|r||j                             d¦  «        v r|                     |¦  «         Œu|st          d|›d�¦  «        ‚t          |¦  «        dk    rt          d	|›d
|›�¦  «        ‚|d         S )z6 return a testreport whose dotted import path matches )rÒ   rÑ   ÚwhenNú::z$could not find test report matching z: no test reports at all!rI   z%found 2 or more testreports matching z: r   )
rô   r÷   ÚpassedÚAttributeErrorÚgetattrÚnodeidrK   rL   Ú
ValueErrorro   )r3   Ú	inamepartrÒ   r÷   r´   Úreps         r   ÚmatchreportzHookRecorder.matchreport  s'  € ð ˆØ—?’?¨�?Ñ/Ô/ð 
	ð 
	ˆCðØð  ¤¨FÒ 2Ð 2°s´zÐ 2àøøÝ!ð ð ð Ø�ðøøøàð �  V¨TÑ2Ô2°dÒ:Ð:ØØð  	¨S¬Z×-=Ò-=¸dÑ-CÔ-CÐ CÐ CØ—’˜‘”�øØð 	GÝ�*Ø:C¸)¸)ðFñ Gô Gð Gåˆq‰6Œ6�AŠ:ˆ:Ý�*Ø@IÀ	À	È1È1ÐMñOô Oð Oà�Œtˆs   œ2²
?¾?c                 ó@   — d„ |                       |¦  «        D ¦   «         S )Nc                 ó    — g | ]}|j         ¯	|‘ŒS rZ   )Úfailed)r\   rÿ   s     r   r^   z,HookRecorder.getfailures.<locals>.<listcomp>  s   € ÐDÐDÐD˜¸¼ÐD�ÐDÐDÐDr   )rô   rÔ   s     r   ÚgetfailureszHookRecorder.getfailures  s"   € àDÐD˜tŸš¨uÑ5Ô5ÐDÑDÔDÐDr   c                 ó,   — |                       d¦  «        S )NÚpytest_collectreport)r  rS   s    r   Úgetfailedcollectionsz!HookRecorder.getfailedcollections!  s   € Ø×ÒÐ 6Ñ7Ô7Ð7r   c                 ó  — g }g }g }|                       d¦  «        D ]m}|j        r+t          |dd ¦  «        dk    r|                     |¦  «         Œ4|j        r|                     |¦  «         ŒQ|j        r|                     |¦  «         Œn|||fS )Nz-pytest_collectreport pytest_runtest_logreportr÷   rÑ   )rô   rù   rû   rL   Úskippedr  )r3   rù   r	  r  rÿ   s        r   ÚlistoutcomeszHookRecorder.listoutcomes$  s®   € ØˆØˆØˆØ—?’?Ø;ñ=ô =ð 	#ð 	#ˆCàŒzð #Ý˜3 ¨Ñ-Ô-°Ò7Ð7Ø—M’M #Ñ&Ô&Ð&øØ”ð #Ø—’˜sÑ#Ô#Ð#Ð#Ø”ð #Ø—’˜cÑ"Ô"Ð"øØ�w Ð&Ð&r   c                 ó>   — d„ |                       ¦   «         D ¦   «         S )Nc                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   )ro   r²   s     r   r^   z.HookRecorder.countoutcomes.<locals>.<listcomp>4  s   € Ð4Ð4Ð4˜1•�A‘”Ð4Ð4Ð4r   )r
  rS   s    r   ÚcountoutcomeszHookRecorder.countoutcomes3  s"   € Ø4Ð4 × 1Ò 1Ñ 3Ô 3Ð4Ñ4Ô4Ð4r   r   c                 ó´   — |                       ¦   «         \  }}}|t          |¦  «        k    sJ ‚|t          |¦  «        k    sJ ‚|t          |¦  «        k    sJ ‚d S r0   )r
  ro   )r3   rù   r	  r  Ú
realpassedÚrealskippedÚ
realfaileds          r   ÚassertoutcomezHookRecorder.assertoutcome6  sg   € Ø.2×.?Ò.?Ñ.AÔ.AÑ+ˆ
�K Ø�˜Z™œÒ(Ð(Ð(Ð(Ø�#˜kÑ*Ô*Ò*Ð*Ð*Ð*Ø�˜Z™œÒ(Ð(Ð(Ð(Ð(Ð(r   c                 ó   — g | j         d d …<   d S r0   )rÄ   rS   s    r   ÚclearzHookRecorder.clear<  s   € ØˆŒ
�1�1�1‰ˆˆr   )rð   )rõ   rð   N©r   r   r   )rz   r{   r|   Ú__doc__r¦   r«   rÕ   ré   rí   rï   rô   r   r  r  r
  r  r  r  rZ   r   r   r¨   r¨   À   s%  € € € € € ðð ð
Sð 
Sð 
Sðð ð ðDð Dð Dð
Jð Jð Jð*&ð &ð &ðð ð ð Ið8ð 8ð 8ð 8ð %'ØDHðð ð ð ð0 JðEð Eð Eð Eð8ð 8ð 8ð'ð 'ð 'ð5ð 5ð 5ð)ð )ð )ð )ðð ð ð ð r   r¨   c                 ó   — t          ¦   «         S r0   )ÚLineCompr¢   s    r   Úlinecompr  @  s   € å‰:Œ:Ðr   ÚLineMatcher)r�   c                 ó   — t           S r0   )r  r¢   s    r   ÚLineMatcher_fixturer  E  s   € åÐr   c                 ó"   — t          | |¦  «        S r0   )ÚTestdir)rž   Útmpdir_factorys     r   Útestdirr   J  s   € å�7˜NÑ+Ô+Ð+r   z(\d+) ([\w-]+)c                   ó&   — e Zd ZdZd„ Zd„ Zdd„ZdS )Ú	RunResulta°  The result of running a command.

    Attributes:

    :ret: The return value.
    :outlines: List of lines captured from stdout.
    :errlines: List of lines captures from stderr.
    :stdout: :py:class:`LineMatcher` of stdout, use ``stdout.str()`` to
       reconstruct stdout or the commonly used
       ``stdout.fnmatch_lines()`` method.
    :stderrr: :py:class:`LineMatcher` of stderr.
    :duration: Duration in seconds.

    c                 óŽ   — || _         || _        || _        t          |¦  «        | _        t          |¦  «        | _        || _        d S r0   )ÚretÚoutlinesÚerrlinesr  Ústdoutr„   Úduration)r3   r$  r%  r&  r(  s        r   r¦   zRunResult.__init___  s@   € ØˆŒØ ˆŒØ ˆŒÝ! (Ñ+Ô+ˆŒÝ! (Ñ+Ô+ˆŒØ ˆŒˆˆr   c                 ó´   — t          | j        ¦  «        D ]B}d|v r<t                               |¦  «        }|r i }|D ]\  }}t	          |¦  «        ||<   Œ|c S ŒCdS )zs Return a dictionary of outcomestring->num from parsing
        the terminal output that the test process produced.ÚsecondsN)Úreversedr%  Úrex_outcomeÚfindallÚint)r3   rE   Úoutcomesr¿   ÚnumÚcats         r   ÚparseoutcomeszRunResult.parseoutcomesg  s€   € õ ˜Tœ]Ñ+Ô+ð 	ð 	ˆDØ˜DÐ Ð Ý&×.Ò.¨tÑ4Ô4�Øð Ø�AØ$,ð *ð *™˜˜SÝ!$ S¡¤˜˜#™˜Ø�H�H�Høð	ð 	r   r   c                 óÖ   — |                       ¦   «         }||                     dd¦  «        k    sJ ‚||                     dd¦  «        k    sJ ‚||                     dd¦  «        k    sJ ‚dS )zŒ assert that the specified outcomes appear with the respective
        numbers (0 means it didn't occur) in the text output from a test run.rù   r   r	  r  N)r2  r›   )r3   rù   r	  r  r¿   s        r   Úassert_outcomeszRunResult.assert_outcomess  sx   € ð ×ÒÑ Ô ˆØ˜Ÿš˜x¨Ñ+Ô+Ò+Ð+Ð+Ð+Ø˜!Ÿ%š% 	¨1Ñ-Ô-Ò-Ð-Ð-Ð-Ø˜Ÿš˜x¨Ñ+Ô+Ò+Ð+Ð+Ð+Ð+Ð+r   Nr  )rz   r{   r|   r  r¦   r2  r4  rZ   r   r   r"  r"  P  sP   € € € € € ðð ð!ð !ð !ð
ð 
ð 
ð,ð ,ð ,ð ,ð ,ð ,r   r"  c                   ó"  — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd2d„Zd„ Zd„ Zd„ ZeZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z d„ Z!d3d!„Z"d"„ Z#d4d%„Z$d&„ Z%d'„ Z&d(„ Z'd)„ Z(d*„ Z)d+„ Z*d,„ Z+d-„ Z,d.„ Z-d5d0„Z.d5d1„Z/dS )6r  a½  Temporary test directory with tools to test/run pytest itself.

    This is based on the ``tmpdir`` fixture but provides a number of
    methods which aid with testing pytest itself.  Unless
    :py:meth:`chdir` is used all methods will use :py:attr:`tmpdir` as
    current working directory.

    Attributes:

    :tmpdir: The :py:class:`py.path.local` instance of the temporary
       directory.

    :plugins: A list of plugins to use with :py:meth:`parseconfig` and
       :py:meth:`runpytest`.  Initially this is an empty list but
       plugins can be added to the list.  The type of items to add to
       the list depend on the method which uses them so refer to them
       for details.

    c                 ó¶  — || _         |                     d¦  «        }|j        j        }t	          d¦  «        D ]C}	 |                     |t          |¦  «        z   ¦  «        }n# t          j        j	        $ r Y Œ?w xY w || _
        g | _        t          t          j        ¦  «        t          t          j        ¦  «        f| _        t#          t          j        ¦  «        | _        |                      ¦   «          | j                              | j        ¦  «         | j         j                             d¦  «        }|dk    r| j        | _        d S |dk    r| j        | _        d S d S )Nr   éd   r   r   r   )rž   Ú
ensuretempÚfunctionrz   ÚrangeÚmkdirrd   r9   rx   ÚEEXISTÚtmpdirÚpluginsrÝ   rk   r    Ú	meta_pathÚ_savesyspathrn   ÚmodulesÚ_savemodulekeysÚchdirrª   Úfinalizer+   Ú	getoptionÚrunpytest_inprocessÚ_runpytest_methodÚrunpytest_subprocess)r3   rž   r  Úbasetmpr�   ræ   r=  Úmethods           r   r¦   zTestdir.__init__’  sA  € ØˆŒà ×+Ò+¨IÑ6Ô6ˆØÔÔ(ˆÝ�s‘”ð 	ð 	ˆAðØ Ÿš t­c°!©f¬f¡}Ñ5Ô5��øÝ”8”?ð ð ð Ø�ðøøøàØˆŒØˆŒÝ!¥#¤(™^œ^­Tµ#´-Ñ-@Ô-@ÐAˆÔÝ"¥3¤;Ñ/Ô/ˆÔØ�
Š
‰ŒˆØŒ×!Ò! $¤-Ñ0Ô0Ð0Ø”Ô$×.Ò.¨}Ñ=Ô=ˆØ�[Ò Ð Ø%)Ô%=ˆDÔ"Ð"Ð"Ø�|Ò#Ð#Ø%)Ô%>ˆDÔ"Ð"Ð"ð $Ð#s   »%A!Á!A8Á7A8c                 ó   — d| j         ›d�S )Nz	<Testdir ú>)r=  rS   s    r   rÀ   zTestdir.__repr__©  s   € € Ø!%¤  Ð.Ð.r   c                 óÐ   — | j         \  t          j        dd…<   t          j        dd…<   t	          | d¦  «        r| j                             ¦   «          |                      ¦   «          dS )a	  Clean up global state artifacts.

        Some methods modify the global interpreter state and this
        tries to clean this up.  It does not remove the temporary
        directory however so it can be looked at after the test run
        has finished.

        NÚ_olddir)r@  rk   r    r?  rj   rN  rC  Údelete_loaded_modulesrS   s    r   rD  zTestdir.finalize¬  sd   € ð )-Ô(9Ñ%�Œ���‰•S”] 1 1 1Ñ%Ý�4˜Ñ#Ô#ð 	!ØŒL×ÒÑ Ô Ð Ø×"Ò"Ñ$Ô$Ð$Ð$Ð$r   c                 ó”   — t          t          j        ¦  «                             | j        ¦  «        D ]}|dk    rt          j        |= ŒdS )z¤Delete modules that have been loaded during a test.

        This allows the interpreter to catch module changes in case
        the module is re-imported.
        zzope.interfaceN)rn   rk   rA  Ú
differencerB  ©r3   r�   s     r   rO  zTestdir.delete_loaded_modulesº  sQ   € õ �œÑ$Ô$×/Ò/°Ô0DÑEÔEð 	&ð 	&ˆDð Ð'Ò'Ð'Ý”K Ð%øð		&ð 	&r   c                 ó”   — t          |d¦  «        rJ ‚t          |¦  «        x|_        }| j                             |j        ¦  «         |S )z:Create a new :py:class:`HookRecorder` for a PluginManager.Úreprec)rj   r¨   rT  rž   rª   r«   )r3   r)   rT  s      r   Úmake_hook_recorderzTestdir.make_hook_recorderÆ  sK   € å˜=¨(Ñ3Ô3Ð3Ð3Ð3Ý(4°]Ñ(CÔ(CÐCˆÔ˜vØŒ×!Ò! &Ô"9Ñ:Ô:Ð:Øˆr   c                 ój   — | j                              ¦   «         }t          | d¦  «        s	|| _        dS dS )zbCd into the temporary directory.

        This is done automatically upon instantiation.

        rN  N)r=  rC  rj   rN  )r3   Úolds     r   rC  zTestdir.chdirÍ  s>   € ð Œk×ÒÑ!Ô!ˆÝ�t˜YÑ'Ô'ð 	ØˆDŒLˆLˆLð	ð 	r   c                 ó   ‡— t          |                     ¦   «         ¦  «        }|r˜t          j                             d¦  «                             t          t          j        j        |¦  «        ¦  «        t          j                             d¦  «        z   }| j        j        j	        }| 
                    d||f¦  «         d }|D ]Ì\  }}	| j                             |¦  «                             |¬¦  «        }
t          |	¦  «        }dd„Šd                     ˆfd„|j        D ¦   «         ¦  «        }t          j                             |¦  «        }|                     ¦   «                              d¦  «        }|
                     |d¦  «         |€|
}ŒÍ|S )	NrG   r   )Úextúutf-8c                 ó†   — t           j                             | ¦  «        r!t           j                             | |¬¦  «        } | S )N©Úencoding)r9   ÚbuiltinÚ_isbytesÚ_totext)Úsr]  s     r   Ú	my_totextz$Testdir._makefile.<locals>.my_totextâ  s:   € Ý”:×&Ò& qÑ)Ô)ð AÝœ
×*Ò*¨1°xÐ*Ñ@Ô@�AØ�r   c                 ó&   •— g | ]} ‰|¦  «        ‘ŒS rZ   rZ   )r\   rE   rb  s     €r   r^   z%Testdir._makefile.<locals>.<listcomp>æ  s!   ø€ Ð'QÐ'QÐ'Q¸D¨	¨	°$©¬Ð'QÐ'QÐ'Qr   Úwb)rZ  )rÝ   Úitemsr9   r^  r`  rs   Úmaprž   r9  rz   Úinsertr=  Únewr   rì   ÚstripÚencodeÚwrite)r3   rY  Úargsr¼   re  ÚsourceÚbasenamer$  r�   ÚvalueÚpÚsource_unicodeÚcontentrb  s                @r   Ú	_makefilezTestdir._makefile×  sq  ø€ Ý�V—\’\‘^”^Ñ$Ô$ˆØð 	0Ý”Z×'Ò'¨Ñ-Ô-×2Ò2Ý•B”JÔ&¨Ñ-Ô-ñ/ô /Ý13´×1CÒ1CÀDÑ1IÔ1IñJˆFà”|Ô,Ô5ˆHØ�LŠL˜˜X vÐ.Ñ/Ô/Ð/ØˆØ ð 	ð 	‰KˆD�%Ø”× Ò  Ñ&Ô&×*Ò*¨sÐ*Ñ3Ô3ˆAÝ˜E‘]”]ˆFðð ð ð ð "ŸYšYÐ'QÐ'QÐ'QÐ'QÀFÄLÐ'QÑ'QÔ'QÑRÔRˆNÝ”Z×'Ò'¨Ñ7Ô7ˆFØ—l’l‘n”n×+Ò+¨GÑ4Ô4ˆGà�GŠG�G˜TÑ"Ô"Ð"Øˆ{Ø�øØˆ
r   c                 ó0   — |                       |||¦  «        S )aƒ  Create a new file in the testdir.

        ext: The extension the file should use, including the dot.
           E.g. ".py".

        args: All args will be treated as strings and joined using
           newlines.  The result will be written as contents to the
           file.  The name of the file will be based on the test
           function requesting this fixture.
           E.g. "testdir.makefile('.txt', 'line1', 'line2')"

        kwargs: Each keyword is the name of a file, while the value of
           it will be written as contents of the file.
           E.g. "testdir.makefile('.ini', pytest='[pytest]
addopts=-rs
')"

        ©rs  )r3   rY  rl  r¼   s       r   ÚmakefilezTestdir.makefileï  s   € ð" �~Š~˜c 4¨Ñ0Ô0Ð0r   c                 ó.   — |                       |¬¦  «        S )z2Write a contest.py file with 'source' as contents.)Úconftest)Ú
makepyfile©r3   rm  s     r   ÚmakeconftestzTestdir.makeconftest  s   € à�Š¨ˆÑ/Ô/Ð/r   c                 ó0   — |                       d|¬¦  «        S )z/Write a tox.ini file with 'source' as contents.z.ini)Útox)rv  rz  s     r   ÚmakeinizTestdir.makeini  s   € à�}Š}˜V¨ˆ}Ñ0Ô0Ð0r   c                 óv   — |                       |¦  «        }t          j                             |¦  «        d         S )z7Return the pytest section from the tox.ini config file.r"   )r~  r9   Ú	iniconfigÚ	IniConfig)r3   rm  rp  s      r   Ú	getinicfgzTestdir.getinicfg
  s.   € à�LŠL˜Ñ Ô ˆÝŒ|×%Ò% aÑ(Ô(¨Ô2Ð2r   c                 ó0   — |                       d||¦  «        S )z.Shortcut for .makefile() with a .py extension.r   ru  ©r3   rl  r¼   s      r   ry  zTestdir.makepyfile  s   € à�~Š~˜e T¨6Ñ2Ô2Ð2r   c                 ó0   — |                       d||¦  «        S )z/Shortcut for .makefile() with a .txt extension.z.txtru  r„  s      r   ÚmaketxtfilezTestdir.maketxtfile  s   € à�~Š~˜f d¨FÑ3Ô3Ð3r   Nc                 óš   — |€| j         }t          j                             dt	          |¦  «        ¦  «         |                      ¦   «          dS )z~Prepend a directory to sys.path, defaults to :py:attr:`tmpdir`.

        This is undone automatically after the test.
        Nr   )r=  rk   r    rg  rd   Ú"_possibly_invalidate_import_caches)r3   r    s     r   ÚsyspathinsertzTestdir.syspathinsert  sF   € ð
 ˆ<Ø”;ˆDÝŒ�Š˜�3˜t™9œ9Ñ%Ô%Ð%ð 	×/Ò/Ñ1Ô1Ð1Ð1Ð1r   c                 ó~   — 	 dd l }t          |d¦  «        r|                     ¦   «          d S d S # t          $ r Y d S w xY w)Nr   Úinvalidate_caches)Ú	importlibrj   r‹  ÚImportError)r3   rŒ  s     r   rˆ  z*Testdir._possibly_invalidate_import_caches$  sn   € ð	.ØÐÐÐõ �yÐ"5Ñ6Ô6ð .Ø×+Ò+Ñ-Ô-Ð-Ð-Ð-ð.ð .øõ ð 	ð 	ð 	ØˆDˆDð	øøøs   ‚. ®
<»<c                 ó6   — | j                              |¦  «        S )zCreate a new (sub)directory.)r=  r;  rR  s     r   r;  zTestdir.mkdir.  s   € àŒ{× Ò  Ñ&Ô&Ð&r   c                 óZ   — |                       |¦  «        }|                     d¦  «         |S )z£Create a new python package.

        This creates a (sub)direcotry with an empty ``__init__.py``
        file so that is recognised as a python package.

        z__init__.py)r;  Úensure)r3   r�   rp  s      r   ÚmkpydirzTestdir.mkpydir2  s,   € ð �JŠJ�tÑÔˆØ	�Š�ÑÔÐØˆr   c                 óV  — t          |¦  «        }dt          |¦  «        vsJ ‚t          j                             |¦  «        }|j                             |¬¦  «         |                     t          |¦  «        gd¬¦  «        d         }|j                             |t          ¬¦  «         |S )a&  Return the collection node of a file.

        :param config: :py:class:`_pytest.config.Config` instance, see
           :py:meth:`parseconfig` and :py:meth:`parseconfigure` to
           create the configuration.

        :param arg: A :py:class:`py.path.local` instance of the file.

        rø   ©ÚsessionF©Úgenitemsr   ©r”  Ú
exitstatus)
r   rd   r9   r    r‡   r¬   Úpytest_sessionstartÚperform_collectÚpytest_sessionfinishr   )r3   r+   Úargr”  rp  Úress         r   ÚgetnodezTestdir.getnode>  s—   € õ ˜&‘/”/ˆØ�3˜s™8œ8Ð#Ð#Ð#Ð#ÝŒG�MŠM˜#ÑÔˆØŒ×'Ò'°Ð'Ñ8Ô8Ð8Ø×%Ò%¥s¨1¡v¤v h¸Ð%Ñ?Ô?ÀÔBˆØŒ×(Ò(°ÅWÐ(ÑMÔMÐMØˆ
r   c                 ó6  — |                       |¦  «        }t          |¦  «        }|j                             |¦  «        }|j                             |¬¦  «         |                     |gd¬¦  «        d         }|j                             |t          ¬¦  «         |S )a  Return the collection node of a file.

        This is like :py:meth:`getnode` but uses
        :py:meth:`parseconfigure` to create the (configured) pytest
        Config instance.

        :param path: A :py:class:`py.path.local` instance of the file.

        r“  Fr•  r   r—  )	Úparseconfigurer   ÚfspathÚbestrelpathr¬   r™  rš  r›  r   )r3   r    r+   r”  r³   r�  s         r   ÚgetpathnodezTestdir.getpathnodeP  s�   € ð ×$Ò$ TÑ*Ô*ˆÝ˜&‘/”/ˆØŒN×&Ò& tÑ,Ô,ˆØŒ×'Ò'°Ð'Ñ8Ô8Ð8Ø×%Ò% q c°EÐ%Ñ:Ô:¸1Ô=ˆØŒ×(Ò(°ÅWÐ(ÑMÔMÐMØˆ
r   c                 ó~   — |d         j         }g }|D ]*}|                     |                     |¦  «        ¦  «         Œ+|S )z¬Generate all test items from a collection node.

        This recurses into the collection node and returns a list of
        all the test items contained within.

        r   )r”  rp   r–  )r3   Úcolitemsr”  ÚresultÚcolitems        r   r–  zTestdir.genitemsb  sL   € ð ˜1”+Ô%ˆØˆØð 	5ð 	5ˆGØ�MŠM˜'×*Ò*¨7Ñ3Ô3Ñ4Ô4Ð4Ð4Øˆr   c                 ó‚   — |                       |¦  «        }| j        j        }|                     ¦   «         } ||¦  «        S )a5  Run the "test_func" Item.

        The calling test instance (the class which contains the test
        method) must provide a ``.getrunner()`` method which should
        return a runner which can run the test protocol for a single
        item, like e.g. :py:func:`_pytest.runner.runtestprotocol`.

        )Úgetitemrž   ÚinstanceÚ	getrunner)r3   rm  rt   ÚtestclassinstanceÚrunners        r   ÚrunitemzTestdir.runitemo  s?   € ð �|Š|˜FÑ#Ô#ˆà œLÔ1ÐØ"×,Ò,Ñ.Ô.ˆØˆv�d‰|Œ|Ðr   c                 óf   — |                       |¦  «        }t          |¦  «        |gz   } | j        |Ž S )a¬  Run a test module in process using ``pytest.main()``.

        This run writes "source" into a temporary file and runs
        ``pytest.main()`` on it, returning a :py:class:`HookRecorder`
        instance for the result.

        :param source: The source code of the test module.

        :param cmdlineargs: Any extra command line arguments to use.

        :return: :py:class:`HookRecorder` instance of the result.

        )ry  rÝ   Ú
inline_run)r3   rm  Úcmdlineargsrp  r´   s        r   Úinline_runsourcezTestdir.inline_runsource  s8   € ð �OŠO˜FÑ#Ô#ˆÝ�ÑÔ  Ñ#ˆØˆtŒ Ð"Ð"r   c                 ód   —  | j         dg|¢R Ž }d„ |                     d¦  «        D ¦   «         }||fS )a¡  Run ``pytest.main(['--collectonly'])`` in-process.

        Retuns a tuple of the collected items and a
        :py:class:`HookRecorder` instance.

        This runs the :py:func:`pytest.main` function to run all of
        pytest inside the test process itself like
        :py:meth:`inline_run`.  However the return value is a tuple of
        the collection items and a :py:class:`HookRecorder` instance.

        z--collect-onlyc                 ó   — g | ]	}|j         ‘Œ
S rZ   )rt   r²   s     r   r^   z+Testdir.inline_genitems.<locals>.<listcomp>ž  s   € ÐFÐFÐF˜A�”ÐFÐFÐFr   Úpytest_itemcollected)r°  rÕ   )r3   rl  Úrecre  s       r   Úinline_genitemszTestdir.inline_genitems‘  sH   € ð ˆdŒoÐ.Ð6°Ð6Ð6Ð6ˆØFÐF §¢Ð.DÑ!EÔ!EÐFÑFÔFˆØ�cˆzÐr   c                 ó¤  ‡ ‡	‡
— t           j        Š	ˆ	fd„}‰ j                             |¦  «         d„ t           _        g Š
 G ˆ
ˆ fd„d¦  «        }|                     d¦  «        pg }|                      |¦   «         ¦  «         t          j        t          |¦  «        |¬¦  «        }‰  	                    ¦   «          t          ‰
¦  «        dk    r‰
                     ¦   «         }n G d„ d	¦  «        }||_        |d
k    rU|                     d¦  «        s@|                     d¦  «        }|r)|d         j        j        t           k    rt!          ¦   «         ‚|S )aŽ  Run ``pytest.main()`` in-process, returning a HookRecorder.

        This runs the :py:func:`pytest.main` function to run all of
        pytest inside the test process itself.  This means it can
        return a :py:class:`HookRecorder` instance which gives more
        detailed results from then run then can be done by matching
        stdout/stderr from :py:meth:`runpytest`.

        :param args: Any command line arguments to pass to
           :py:func:`pytest.main`.

        :param plugin: (keyword-only) Extra plugin instances the
           ``pytest.main()`` instance should use.

        :return: A :py:class:`HookRecorder` instance.
        c                  ó    •— ‰ t           _        d S r0   )r   Ú_warn_already_imported)Ú	orig_warns   €r   Úrevertz"Testdir.inline_run.<locals>.revert·  s   ø€ Ø<EÕ"Ô9Ð9Ð9r   c                  ó   — d S r0   rZ   )Úas    r   ú<lambda>z$Testdir.inline_run.<locals>.<lambda>º  s   € À4€ r   c                   ó   •— e Zd Zˆ ˆfd„ZdS )ú#Testdir.inline_run.<locals>.Collectc                 ób   •— ‰                      ‰                     |j        ¦  «        ¦  «         d S r0   )rL   rU  r)   )r³   r+   r¶  r3   s     €€r   r-   z4Testdir.inline_run.<locals>.Collect.pytest_configure¾  s,   ø€ Ø—
’
˜4×2Ò2°6Ô3GÑHÔHÑIÔIÐIÐIÐIr   N)rz   r{   r|   r-   )r¶  r3   s   €€r   ÚCollectrÁ  ½  s;   ø€ € € € € ðJð Jð Jð Jð Jð Jð Jð Jr   rÃ  r>  )r>  rI   c                   ó   — e Zd ZdS )ú"Testdir.inline_run.<locals>.reprecN)rz   r{   r|   rZ   r   r   rT  rÅ  È  s   € € € € € Ø�r   rT  é   Úno_reraise_ctrlcÚpytest_keyboard_interruptéÿÿÿÿ)r   rº  rž   rª   r›   rL   r"   ÚmainrÝ   rO  ro   rà   r$  rÕ   ÚexcinfoÚtypeÚKeyboardInterrupt)r3   rl  r¼   r¼  rÃ  r>  r$  rT  rÄ   r»  r¶  s   `        @@r   r°  zTestdir.inline_run¡  sš  øøø€ õ* +ÔAˆ	ð	Fð 	Fð 	Fð 	Fð 	FàŒ×!Ò! &Ñ)Ô)Ð)Ø8G¸ÕÔ5àˆð	Jð 	Jð 	Jð 	Jð 	Jð 	Jð 	Jð 	Jñ 	Jô 	Jð 	Jð —*’*˜YÑ'Ô'Ð-¨2ˆØ�Š�w�w‘y”yÑ!Ô!Ð!ÝŒk�$˜t™*œ*¨gÐ6Ñ6Ô6ˆØ×"Ò"Ñ$Ô$Ð$Ýˆs‰8Œ8�qŠ=ˆ=Ø—W’W‘Y”YˆFˆFðð ð ð ð ñ ô ð àˆŒ
ð �!Š8ˆ8˜FŸJšJÐ'9Ñ:Ô:ˆ8Ø—O’OÐ$?Ñ@Ô@ˆEØð *˜˜rœÔ*Ô/Õ3DÒDÐDÝ'Ñ)Ô)Ð)Øˆr   c                 óŽ  ‡	— |                      d¦  «        r|                      ¦   «          t          j        ¦   «         }t          j                             ¦   «         }	 	  | j        |i |¤Ž}nQ# t          $ rŠ	 G ˆ	fd„d¦  «        }Y dŠ	‹	n3dŠ	‹	wt          $ r# t          j
        ¦   «           G d„ d¦  «        }Y nw xY w|                     ¦   «         \  }}t          j                             |¦  «         t          j                             |¦  «         nZ# |                     ¦   «         \  }}t          j                             |¦  «         t          j                             |¦  «         w xY wt!          |j        |                     d¦  «        |                     d¦  «        t          j        ¦   «         |z
  ¦  «        }||_        |S )zv Return result of running pytest in-process, providing a similar
        interface to what self.runpytest() provides. r‰  c                   ó*   •— e Zd Z” j        d         ZdS )ú+Testdir.runpytest_inprocess.<locals>.reprecr   N)rz   r{   r|   rl  r$  )Úes   €r   rT  rÐ  ß  s   ø€ € € € € Øœ& œ)�C�C�Cr   rT  Nc                   ó   — e Zd ZdZdS )rÐ  é   N)rz   r{   r|   r$  rZ   r   r   rT  z+Testdir.runpytest_inprocess.<locals>.reprecã  s   € € € € € Ø�C�C�Cr   rG   )r›   r‰  Útimer9   ÚioÚ
StdCapturer°  Ú
SystemExitÚ	ExceptionÚ	tracebackÚ	print_excÚresetrk   r'  rk  r„   r"  r$  rK   rT  )
r3   rl  r¼   ÚnowÚcapturerT  r4   r‘   r�  rÑ  s
            @r   rF  zTestdir.runpytest_inprocessÔ  s÷  ø€ ð �:Š:�oÑ&Ô&ð 	!Ø×ÒÑ Ô Ð ÝŒi‰kŒkˆÝ”%×"Ò"Ñ$Ô$ˆð	"ðØ(˜œ¨$Ð9°&Ð9Ð9��øÝð $ð $ð $ð$ð $ð $ð $ð $ð $ð $ñ $ô $ð $ð $ð $ð $ð $ð $øøøøåð ð ð ÝÔ#Ñ%Ô%Ð%ðð ð ð ð ñ ô ð ð ð ðøøøð
 —}’}‘”‰HˆC�ÝŒJ×Ò˜SÑ!Ô!Ð!ÝŒJ×Ò˜SÑ!Ô!Ð!Ð!øð —}’}‘”‰HˆC�ÝŒJ×Ò˜SÑ!Ô!Ð!ÝŒJ×Ò˜SÑ!Ô!Ð!Ð!øøøå˜œ
ØŸ	š	 $™œ¨¯ª°4©¬Ýœ	™œ C™ñ)ô )ˆð ˆŒ
Øˆ
s=   ÁA, Á+D Á,
B:Á6B
ÂD Â
-B:Â7D Â9B:Â:D ÄAE*c                 óF   — |                       |¦  «        } | j        |i |¤ŽS )z� Run pytest inline or in a subprocess, depending on the command line
        option "--runpytest" and return a :py:class:`RunResult`.

        )Ú_ensure_basetemprG  r„  s      r   r   zTestdir.runpytestð  s/   € ð
 ×$Ò$ TÑ*Ô*ˆØ%ˆtÔ% tÐ6¨vÐ6Ð6Ð6r   c                 óÐ   — d„ |D ¦   «         }|D ]&}t          |¦  «                             d¦  «        r n1Œ'|                     d| j                             d¦  «        z  ¦  «         |S )Nc                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   rc   r²   s     r   r^   z,Testdir._ensure_basetemp.<locals>.<listcomp>ù  s   € Ð%Ð%Ð%˜1•�A‘”Ð%Ð%Ð%r   z
--basetempú--basetemp=%sÚbasetemp)rd   rD   rL   r=  Údirpath)r3   rl  r³   s      r   rß  zTestdir._ensure_basetempø  sz   € Ø%Ð% Ð%Ñ%Ô%ˆØð 	Kð 	KˆAÝ�1‰vŒv× Ò  Ñ.Ô.ð à�ðð �KŠK˜¨$¬+×*=Ò*=¸jÑ*IÔ*IÑIÑJÔJÐJàˆr   c                 ó¶   — |                       |¦  «        }ddl}|j                             || j        ¦  «        }| j                             |j        ¦  «         |S )aÉ  Return a new pytest Config instance from given commandline args.

        This invokes the pytest bootstrapping code in _pytest.config
        to create a new :py:class:`_pytest.core.PluginManager` and
        call the pytest_cmdline_parse hook to create new
        :py:class:`_pytest.config.Config` instance.

        If :py:attr:`plugins` has been populated they should be plugin
        modules which will be registered with the PluginManager.

        r   N)rß  Ú_pytest.configr+   Ú_prepareconfigr>  rž   rª   Ú_ensure_unconfigure)r3   rl  r£   r+   s       r   ÚparseconfigzTestdir.parseconfig  s\   € ð ×$Ò$ TÑ*Ô*ˆàÐÐÐØ”×.Ò.¨t°T´\ÑBÔBˆð 	Œ×!Ò! &Ô"<Ñ=Ô=Ð=Øˆr   c                 ó€   —  | j         |Ž }|                     ¦   «          | j                             |j        ¦  «         |S )z×Return a new pytest configured Config instance.

        This returns a new :py:class:`_pytest.config.Config` instance
        like :py:meth:`parseconfig`, but also calls the
        pytest_configure hook.

        )ré  Ú_do_configurerž   rª   rè  )r3   rl  r+   s      r   r   zTestdir.parseconfigure  sC   € ð "�Ô! 4Ð(ˆØ×ÒÑÔÐØŒ×!Ò! &Ô"<Ñ=Ô=Ð=Øˆr   Ú	test_funcc                 óx   — |                       |¦  «        }|D ]}|j        |k    r|c S ŒJ |›d|›d|›�¦   «         ‚)av  Return the test item for a test function.

        This writes the source to a python file and runs pytest's
        collection on the resulting module, returning the test item
        for the requested function name.

        :param source: The module source.

        :param funcname: The name of the test function for which the
           Item must be returned.

        r   z item not found in module:
z
items: )Úgetitemsr�   )r3   rm  Úfuncnamere  rt   s        r   r©  zTestdir.getitem&  si   € ð —’˜fÑ%Ô%ˆØð 	ð 	ˆDØŒy˜HÒ$Ð$Ø���ð %ð	+Ø�(�(˜F˜F˜F E Eð+ñ 	+ô 	+ð 	+r   c                 óX   — |                       |¦  «        }|                      |g¦  «        S )zÜReturn all test items collected from the module.

        This writes the source to a python file and runs pytest's
        collection on the resulting module, returning all test items
        contained within.

        )Úgetmodulecolr–  )r3   rm  Úmodcols      r   rî  zTestdir.getitems:  s+   € ð ×"Ò" 6Ñ*Ô*ˆØ�}Š}˜f˜XÑ&Ô&Ð&r   rZ   Fc                 ó
  — | j         j        j        t          |¦  «                             ¦   «         i} | j        di |¤Ž}|r|                      d¬¦  «          | j        |g|¢R Ž x| _        }|                      ||¦  «        }|S )a  Return the module collection node for ``source``.

        This writes ``source`` to a file using :py:meth:`makepyfile`
        and then runs the pytest collection on it, returning the
        collection node for the test module.

        :param source: The source code of the module to collect.

        :param configargs: Any extra arguments to pass to
           :py:meth:`parseconfigure`.

        :param withinit: Whether to also write a ``__init__.py`` file
           to the temporarly directory to ensure it is a package.

        ú#)r¦   rZ   )	rž   r9  rz   r   ri  ry  r   r+   rž  )r3   rm  Ú
configargsÚwithinitÚkwr    r+   Únodes           r   rñ  zTestdir.getmodulecolE  s”   € ð  ŒlÔ#Ô,­f°V©n¬n×.BÒ.BÑ.DÔ.DÐEˆØˆtŒÐ$Ð$ Ð$Ð$ˆØð 	,Ø�OŠO sˆOÑ+Ô+Ð+Ø2˜tÔ2°4ÐE¸*ÐEÐEÐEÐEˆŒ�fØ�|Š|˜F DÑ)Ô)ˆØˆr   c                 óR   — |                      ¦   «         D ]}|j        |k    r|c S ŒdS )aC  Return the collection node for name from the module collection.

        This will search a module collection node for a collection
        node matching the given name.

        :param modcol: A module collection node, see
           :py:meth:`getmodulecol`.

        :param name: The name of the node to return.

        N)Ú_memocollectr�   )r3   rò  r�   r§  s       r   Úcollect_by_namezTestdir.collect_by_name]  sD   € ð ×*Ò*Ñ,Ô,ð 	ð 	ˆGØŒ|˜tÒ#Ð#Ø���ð $ð	ð 	r   c           
      ó:  — t           j                             ¦   «         }t           j                             t          dt          t          j        ¦   «         ¦  «        |                     dd¦  «        g¦  «        ¦  «        |d<   ||d<   t          j
        |f||dœ|¤ŽS )zÆInvoke subprocess.Popen.

        This calls subprocess.Popen making sure the current working
        directory is the PYTHONPATH.

        You probably want to use :py:meth:`run` instead.

        NÚ
PYTHONPATHrõ   Úenv)r'  r„   )r   Úenvironr¾   Úpathseprs   Úfilterrd   Úgetcwdr›   r   r‰   )r3   Úcmdargsr'  r„   r÷  rþ  s         r   r�   zTestdir.popenm  s    € õ Œj�oŠoÑÔˆÝœJŸOšO­F°4Ý•”	‘”ÑÔ˜cŸgšg l°BÑ7Ô7ð:9ñ -:ô -:ñ ;ô ;ˆˆLÑàˆˆ5‰	ÝÔ ð DØ'-°fðDð DØ@BðDð Dð 	Dr   c                 ó   —  | j         |Ž S )z¥Run a command with arguments.

        Run a process using subprocess.Popen saving the stdout and
        stderr.

        Returns a :py:class:`RunResult`.

        )Ú_run)r3   r  s     r   ÚrunzTestdir.run}  s   € ð ˆtŒy˜'Ð"Ð"r   c                 ó¶  — d„ |D ¦   «         }| j                              d¦  «        }| j                              d¦  «        }t          dd                     |¦  «        ¦  «         t          dt          t          j                             ¦   «         ¦  «        ¦  «         t          j        t          |¦  «        dd¬	¦  «        }t          j        t          |¦  «        dd¬	¦  «        }	 t          j	        ¦   «         }|  
                    |||t          j        d
k    ¬¦  «        }|                     ¦   «         }|                     ¦   «          |                     ¦   «          n-# |                     ¦   «          |                     ¦   «          w xY wt          j        t          |¦  «        dd¬	¦  «        }t          j        t          |¦  «        dd¬	¦  «        }	 |                     ¦   «                              ¦   «         }	|                     ¦   «                              ¦   «         }
|                     ¦   «          |                     ¦   «          n-# |                     ¦   «          |                     ¦   «          w xY w|                      |	t          j        ¦  «         |                      |
t          j        ¦  «         t)          ||	|
t          j	        ¦   «         |z
  ¦  «        S )Nc                 ó,   — g | ]}t          |¦  «        ‘ŒS rZ   rc   r²   s     r   r^   z Testdir._run.<locals>.<listcomp>‰  s   € Ð+Ð+Ð+˜a•3�q‘6”6Ð+Ð+Ð+r   r'  r„   zrunning:ú z     in:ÚwÚutf8r\  r—   )r'  r„   Ú	close_fdsÚr)r=  rs   r   rd   r9   r    r‡   ÚcodecsÚopenrÔ  r�   rk   r™   ÚwaitÚcloseÚreadÚ
splitlinesÚ_dump_linesr'  r„   r"  )r3   r  Úp1Úp2Úf1Úf2rÜ  r�   r$  r4   r‘   s              r   r  zTestdir._runˆ  s3  € Ø+Ð+ 7Ð+Ñ+Ô+ˆØŒ[×Ò˜hÑ'Ô'ˆØŒ[×Ò˜hÑ'Ô'ˆÝˆz˜3Ÿ8š8 GÑ,Ô,Ñ-Ô-Ð-Ýˆz�3�rœwŸ}š}™œÑ/Ô/Ñ0Ô0Ð0ÝŒ[�˜R™œ #°Ð7Ñ7Ô7ˆÝŒ[�˜R™œ #°Ð7Ñ7Ô7ˆð	Ý”)‘+”+ˆCØ—J’J˜w¨r¸"Ýœ<¨7Ò2ð ñ 5ô 5ˆEà—*’*‘,”,ˆCà�HŠH‰JŒJˆJØ�HŠH‰JŒJˆJˆJøð �HŠH‰JŒJˆJØ�HŠH‰JŒJˆJˆJøøøÝŒ[�˜R™œ #°Ð7Ñ7Ô7ˆÝŒ[�˜R™œ #°Ð7Ñ7Ô7ˆð	Ø—'’'‘)”)×&Ò&Ñ(Ô(ˆCØ—'’'‘)”)×&Ò&Ñ(Ô(ˆCà�HŠH‰JŒJˆJØ�HŠH‰JŒJˆJˆJøð �HŠH‰JŒJˆJØ�HŠH‰JŒJˆJˆJøøøØ×Ò˜�cœjÑ)Ô)Ð)Ø×Ò˜�cœjÑ)Ô)Ð)Ý˜˜c 3­¬	©¬°C©Ñ8Ô8Ð8s   Ã&AE Å*FÇAI É*I2c                 óœ   — 	 |D ]#}t           j                             ||¬¦  «         Œ$d S # t          $ r t	          d|›d�¦  «         Y d S w xY w)N)Úfilezcouldn't print to z because of encoding)r9   r^  r   ÚUnicodeEncodeErrorÚprint)r3   rì   ÚfprE   s       r   r  zTestdir._dump_lines¤  s~   € ð	FØð 1ð 1�Ý”
×!Ò! $¨RÐ!Ñ0Ô0Ð0Ð0ð1ð 1øå!ð 	Fð 	Fð 	FÝˆEÀÀÀÐDÑEÔEÐEÐEÐEÐEð	Føøøs   ‚&* ªAÁ
Ac                 ó(   — t           j        t          fS r0   )rk   r�   r   rS   s    r   Ú_getpytestargszTestdir._getpytestargs«  s   € õ ”Õ 0Ð2Ð2r   c                 óB   — |                       t          j        |¦  «        S )zkRun a python script using sys.executable as interpreter.

        Returns a :py:class:`RunResult`.
        ©r  rk   r�   )r3   Úscripts     r   Ú	runpythonzTestdir.runpython°  s   € ð
 �xŠx�œ¨Ñ/Ô/Ð/r   c                 óD   — |                       t          j        d|¦  «        S )z8Run python -c "command", return a :py:class:`RunResult`.z-cr!  )r3   Úcommands     r   Úrunpython_czTestdir.runpython_c·  s   € à�xŠx�œ¨¨gÑ6Ô6Ð6r   c                 óî   — t           j        j                             dd| j        ¬¦  «        }d|z  f|z   }d„ | j        D ¦   «         }|rd|d         f|z   }|                      ¦   «         |z   } | j        |Ž S )aÛ  Run pytest as a subprocess with given arguments.

        Any plugins added to the :py:attr:`plugins` list will added
        using the ``-p`` command line option.  Addtionally
        ``--basetemp`` is used put any temporary files and directories
        in a numbered directory prefixed with "runpytest-" so they do
        not conflict with the normal numberd pytest location for
        temporary files and directories.

        Returns a :py:class:`RunResult`.

        z
runpytest-N)ÚprefixÚkeepÚrootdirrâ  c                 ó<   — g | ]}t          |t          ¦  «        ¯|‘ŒS rZ   )rÓ   rd   r²   s     r   r^   z0Testdir.runpytest_subprocess.<locals>.<listcomp>Ñ  s'   € ÐAÐAÐA˜­j¸½CÑ.@Ô.@ÐA�1ÐAÐAÐAr   z-pr   )r9   r    r‡   Úmake_numbered_dirr=  r>  r  r  )r3   rl  r¼   rp  r>  s        r   rH  zTestdir.runpytest_subprocess»  s”   € õ ŒGŒM×+Ò+°<Ø˜tœ{ð ,ñ ,ô ,ˆà !Ñ#Ð&¨Ñ-ˆð BÐA˜dœlÐAÑAÔAˆØð 	-Ø˜' !œ*Ð%¨Ñ,ˆDØ×"Ò"Ñ$Ô$ tÑ+ˆØˆtŒx˜ˆÐr   ç      $@c                 óì   — | j                              d¦  «        }d                     t          t          |                      ¦   «         ¦  «        ¦  «        }|›d|›d|›�}|                      ||¬¦  «        S )z³Run pytest using pexpect.

        This makes sure to use the right pytest and sets up the
        temporary directory locations.

        The pexpect child is returned.

        Úpexpectr	  z --basetemp=)Úexpect_timeout)r=  r;  rs   rf  rd   r  Úspawn)r3   Ústringr0  rã  ÚinvokeÚcmds         r   Úspawn_pytestzTestdir.spawn_pytest×  sl   € ð ”;×$Ò$ YÑ/Ô/ˆØ—’�#�c 4×#6Ò#6Ñ#8Ô#8Ñ9Ô9Ñ:Ô:ˆØ'- v v¨x¨x¨x¸¸Ð@ˆØ�zŠz˜#¨nˆzÑ=Ô=Ð=r   c                 ó.  — t          j        dd¦  «        }t          t          d¦  «        r)dt	          j        ¦   «         v rt          j        d¦  «         t          j        dk    rt          j        d¦  «         t          j                             d¦  «        rt          j        d	¦  «         | j	         
                    d
¦  «                             d¦  «        }|                     ||¬¦  «        }| j                             |j        ¦  «         ||_        |S )zMRun a command using pexpect.

        The pexpect child is returned.
        r/  z3.0rW   Ú64zpypy-64 bit not supportedÚdarwinz*pexpect does not work reliably on darwin?!Úfreebsdz)pexpect does not work reliably on freebsdz	spawn.outrd  )Úlogfile)r"   Úimportorskiprj   rk   r™   Úmachiner�   ÚxfailrD   r=  rs   r  r1  rž   rª   r  Útimeout)r3   r4  r0  r/  r:  Úchilds         r   r1  zTestdir.spawnå  sñ   € õ
 Ô% i°Ñ7Ô7ˆÝ•3Ð+Ñ,Ô,ð 	5°½Ô9IÑ9KÔ9KÐ1KÐ1KÝŒKÐ3Ñ4Ô4Ð4ÝŒ<˜8Ò#Ð#ÝŒLÐEÑFÔFÐFÝŒ<×"Ò" 9Ñ-Ô-ð 	FÝŒLÐDÑEÔEÐEØ”+×"Ò" ;Ñ/Ô/×4Ò4°TÑ:Ô:ˆØ—’˜c¨7�Ñ3Ô3ˆØŒ×!Ò! '¤-Ñ0Ô0Ð0Ø&ˆŒØˆr   r0   )rì  )rZ   F)r-  )0rz   r{   r|   r  r¦   rÀ   rD  rO  rU  rC  rs  rv  r{  r~  r‚  ry  r†  r‰  rˆ  r;  r‘  r   rž  r£  r–  r®  r²  r·  r°  rF  r   rß  ré  r   r©  rî  rñ  rû  r�   r  r  r  r  r#  r&  rH  r5  r1  rZ   r   r   r  r  }  sÊ  € € € € € ðð ð(?ð ?ð ?ð./ð /ð /ð%ð %ð %ð
&ð 
&ð 
&ðð ð ðð ð ðð ð ð01ð 1ð 1ð&0ð 0ð 0ð1ð 1ð 1ð3ð 3ð 3ð
3ð 3ð 3ð4ð 4ð 4ð2ð 2ð 2ð 2ð.ð .ð .ð'ð 'ð 'ð	ð 	ð 	ð €Gðð ð ð$ð ð ð$ð ð ðð ð ð #ð #ð #ð$ð ð ð 1ð 1ð 1ðfð ð ð87ð 7ð 7ð	ð 	ð 	ðð ð ð,ð ð ð+ð +ð +ð +ð(	'ð 	'ð 	'ðð ð ð ð0ð ð ð Dð Dð Dð 	#ð 	#ð 	#ð9ð 9ð 9ð8Fð Fð Fð3ð 3ð 3ð
0ð 0ð 0ð7ð 7ð 7ðð ð ð8>ð >ð >ð >ðð ð ð ð ð r   r  c                 ó’   — 	 |                       d¦  «        S # t          $ r% dt          j                             | ¦  «        ›�cY S w xY w)NrZ  z0INTERNAL not-utf8-decodeable, truncated string:
)ÚdecoderR   r9   rÕ  Úsaferepr)r4   s    r   Ú
getdecodedrC  ÷  sa   € ð	*Ø—:’:˜gÑ&Ô&Ð&øÝ!ð 	*ð 	*ð 	*ð 	*å”E—N’N 3Ñ'Ô'Ð'ð*ð *ð *ð *ð	*øøøs   ‚ —,AÁAc                   ó   — e Zd Zd„ Zd„ ZdS )r  c                 óL   — t           j                             ¦   «         | _        d S r0   )r9   rÕ  ÚTextIOÚstringiorS   s    r   r¦   zLineComp.__init__   s   € ÝœŸš™œˆŒˆˆr   c                 ó  — d}| j                              ¦   «         }| j                              d¦  «         | j                              d¦  «         |                     d¦  «        }t          |¦  «                             |¦  «        S )zo assert that lines2 are contained (linearly) in lines1.
            return a list of extralines found.
        Tr   rG   )rG  r&   ÚtruncateÚseekrK   r  Úfnmatch_lines)r3   rv   rå   Úvalru   s        r   Úassert_contains_lineszLineComp.assert_contains_lines  st   € ð !ÐØŒm×$Ò$Ñ&Ô&ˆØŒ×Ò˜qÑ!Ô!Ð!ØŒ×Ò˜1ÑÔÐØ—’˜4‘”ˆÝ˜6Ñ"Ô"×0Ò0°Ñ8Ô8Ð8r   N)rz   r{   r|   r¦   rM  rZ   r   r   r  r  ÿ  s2   € € € € € ð'ð 'ð 'ð	9ð 	9ð 	9ð 	9ð 	9r   r  c                   óR   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	e
d„ ¦   «         Zd	„ Zd
S )r  zâFlexible matching of text.

    This is a convenience class to test large texts like the output of
    commands.

    The constructor takes a list of lines without their trailing
    newlines, i.e. ``text.splitlines()``.

    c                 ó"   — || _         g | _        d S r0   )rì   Ú_log_output)r3   rì   s     r   r¦   zLineMatcher.__init__  s   € ØˆŒ
ØˆÔÐÐr   c                 ó6   — d                      | j        ¦  «        S )z Return the entire original text.rG   )rs   rì   rS   s    r   rd   zLineMatcher.str  s   € à�yŠy˜œÑ$Ô$Ð$r   c                 óª   — t          |t          ¦  «        rt          |¦  «        }t          |t          ¦  «        r|                     ¦   «         j        }|S r0   )rÓ   rd   r   ri  rì   )r3   rv   s     r   Ú	_getlineszLineMatcher._getlines"  sF   € Ý�f�cÑ"Ô"ð 	$Ý˜F‘^”^ˆFÝ�f�fÑ%Ô%ð 	*Ø—\’\‘^”^Ô)ˆFØˆr   c                 ó  — |                       |¦  «        }|D ]s}| j        D ]=}||k    st          ||¦  «        r%|                      dt	          |¦  «        ¦  «          n-Œ>|                      d|z  ¦  «         t          | j        ¦  «        ‚ŒtdS )z´Check lines exist in the output.

        The argument is a list of lines which have to occur in the
        output, in any order.  Each line can contain glob whildcards.

        z	matched: úline %r not found in outputN)rS  rì   r   Ú_logrã   rý   Ú	_log_text)r3   rv   rE   r³   s       r   Úfnmatch_lines_randomz LineMatcher.fnmatch_lines_random)  s©   € ð —’ Ñ'Ô'ˆØð 	1ð 	1ˆDØ”Zð 1ð 1�Ø˜1’9�9¥¨¨4Ñ 0Ô 0�9Ø—I’I˜k­4°©:¬:Ñ6Ô6Ð6Ø�Eð ð —	’	Ð7¸$Ñ>Ñ?Ô?Ð?Ý  ¤Ñ0Ô0Ð0ð ð		1ð 	1r   c                 ó®   — t          | j        ¦  «        D ]/\  }}||k    st          ||¦  «        r| j        |dz   d…         c S Œ0t          d|z  ¦  «        ‚)zsReturn all lines following the given line in the text.

        The given line can contain glob wildcards.
        rI   NrU  )rá   rì   r   rý   )r3   Úfnlineræ   rE   s       r   Úget_lines_afterzLineMatcher.get_lines_after:  sl   € õ
 ! ¤Ñ,Ô,ð 	(ð 	(‰GˆAˆtØ˜Š~ˆ~¥¨¨vÑ!6Ô!6ˆ~Ø”z ! A¡# $ $Ô'Ð'Ð'Ð'ð åÐ6¸Ñ?Ñ@Ô@Ð@r   c                 ót   — | j                              d                     d„ |D ¦   «         ¦  «        ¦  «         d S )Nr	  c              3   ó4   K  — | ]}t          |¦  «        V — Œd S r0   rc   r²   s     r   ú	<genexpr>z#LineMatcher._log.<locals>.<genexpr>E  s(   è è € Ð)?Ð)?°Q­#¨a©&¬&Ð)?Ð)?Ð)?Ð)?Ð)?Ð)?r   )rP  rL   rs   )r3   rl  s     r   rV  zLineMatcher._logD  s:   € ØÔ×Ò §¢Ð)?Ð)?¸$Ð)?Ñ)?Ô)?Ñ @Ô @ÑAÔAÐAÐAÐAr   c                 ó6   — d                      | j        ¦  «        S )NrG   )rs   rP  rS   s    r   rW  zLineMatcher._log_textG  s   € à�yŠy˜Ô)Ñ*Ô*Ð*r   c                 óÀ  — |                       |¦  «        }| j        dd…         }d}g }d}|D �]/}d}|r÷|                     d¦  «        }||k    r$|                      dt	          |¦  «        ¦  «         nét          ||¦  «        rG|                      dt	          |¦  «        ¦  «         |                      dt	          |¦  «        ¦  «         n’|s%|                      dt	          |¦  «        ¦  «         d}|                      d	t	          |¦  «        ¦  «         |                     |¦  «         |°÷|                      d
|›�¦  «         t          j        | j	        ¦  «         �Œ1dS )a	  Search the text for matching lines.

        The argument is a list of lines which have to match and can
        use glob wildcards.  If they do not match an pytest.fail() is
        called.  The matches and non-matches are also printed on
        stdout.

        NTFr   zexact match:zfnmatch:z   with:znomatch:z    and:zremains unmatched: )
rS  rì   rà   rV  rã   r   rL   r"   rr   rW  )r3   rv   ru   ÚnextlineÚ
extralinesrå   rE   Únomatchprinteds           r   rK  zLineMatcher.fnmatch_linesK  sg  € ð —’ Ñ'Ô'ˆØ”˜A˜A˜A”ˆØˆØˆ
Ø ÐØð 	,ñ 	,ˆDØ"ˆNØð ,Ø!Ÿ:š: a™=œ=�Ø˜8Ò#Ð#Ø—I’I˜n­d°4©j¬jÑ9Ô9Ð9ØÝ˜X tÑ,Ô,ð :Ø—I’I˜j­$¨t©*¬*Ñ5Ô5Ð5Ø—I’I˜j­$¨x©.¬.Ñ9Ô9Ð9Øà)ð .ØŸ	š	 *­d°4©j¬jÑ9Ô9Ð9Ø)-˜Ø—I’I˜j­$¨x©.¬.Ñ9Ô9Ð9Ø×!Ò! (Ñ+Ô+Ð+ð ð ,ð  —	’	�	°T°TÐ;Ñ<Ô<Ð<Ý”˜DœNÑ+Ô+Ð+ùð'	,ð 	,r   N)rz   r{   r|   r  r¦   rd   rS  rX  r[  rV  ÚpropertyrW  rK  rZ   r   r   r  r    s¨   € € € € € ðð ðð ð ð%ð %ð %ðð ð ð1ð 1ð 1ð"Að Að AðBð Bð Bð ð+ð +ñ „Xð+ð!,ð !,ð !,ð !,ð !,r   )-r  r  rl   r   r™   Úrer   rk   rÔ  rÙ  r   Ú
py.builtinr   Ú_pytest._coder   r9   r"   Ú_pytest.mainr   r   Ú_pytest.assertion.rewriter   r   r-   Úobjectr'   rš   r’   ÚfixturerŸ   r£   r¡   rµ   r·   r¨   r  r  r   Úcompiler,  r"  r  rC  r  r  rZ   r   r   ú<module>rm     sŒ  ðØ LÐ LØ €€€Ø 	€	€	€	Ø 	€	€	€	Ø €€€Ø 	€	€	€	Ø Ð Ð Ð Ø 
€
€
€
Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð à  Ð  Ð  Ð  Ð  Ð  Ø 	€	€	€	Ø €€€Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ø <Ð <Ð <Ð <Ð <Ð <ð	=ð 	=ð 	=ð3ð 3ð 3ð:9ð :9ð :9ð :9ð :9˜ñ :9ô :9ð :9ð~ +Ø*Ø*Ø*Ø*Ø*Ø*ðð €ð !ð ð ð ð ð* €„ð )ð )ð )ð *ñ *ô *ðð ñ*ô *ðð „ðð ñ „ððð ð ð ð ñ ô ð ð)ð )ð )ð
8ð 8ð 8ð 8ð 8ñ 8ô 8ð 8ð}ð }ð }ð }ð }ñ }ô }ð }ð@ „ðð ñ „ðð €„�]Ð#Ñ#Ô#ðð ñ $Ô#ðð „ð,ð ,ñ „ð,ð ˆbŒjÐ)Ñ*Ô*€ð),ð ),ð ),ð ),ð ),ñ ),ô ),ð ),ðZx	ð x	ð x	ð x	ð x	ñ x	ô x	ð x	ðt*ð *ð *ð9ð 9ð 9ð 9ð 9ñ 9ô 9ð 9ð ],ð ],ð ],ð ],ð ],ñ ],ô ],ð ],ð ],ð ],r   