a
    /§»a,|  ã                   @   sl  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mZ ddl	m
Z
 ddl	mZ ddl	mZ ddl	mZ ddl	mZ dd	l	mZ dd
l	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddl	mZ ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl+m-Z- ddl+m.Z. ddl/m0Z0 dd l/m1Z1 dd!l2m3Z3 dd"l2m4Z4 e�rÞdd#l5m6Z6 e&dd$œd%d&„Z7e8e8d'œd(d)„Z9ee
ed*geee:e!f  f ee:e!f d+œd,d-„Z;eee:e!f d.œd/d0„Z<ed*eee:e!f  d1œd2d3„Z=d*dd4œd5d6„Z>d*e?d4œd7d8„Z@ejAjBe?d'œd9d:„ZCejAjBeee? d;œd<d=„ZDeejE edd>œd?d@„ZFG dAdB„ dBƒZGG dCdD„ dDeHƒZIG dEdF„ dFeJƒZKejLG dGdH„ dHeee8f ƒƒZMeG dId*„ d*ejNƒƒZOe8e8dJœdKdL„ZPdMdNœee8e?eejAjBee8 f dOœdPdQ„ZQdS )RzHCore implementation of the testing process: init, session, runtest loop.é    N)ÚPath)ÚCallable)ÚDict)Ú	FrozenSet)ÚIterator)ÚList)ÚOptional)Úoverload)ÚSequence)ÚSet)ÚTuple)ÚType)ÚTYPE_CHECKING)ÚUnion)Únodes)Úfinal)ÚConfig)Údirectory_arg)ÚExitCode)Úhookimpl)ÚPytestPluginManager)Ú
UsageError)ÚParser)ÚFixtureManager)Úexit)Úabsolutepath)Úbestrelpath)Úvisit)ÚCollectReport)Ú
TestReport)Úcollect_one_node)Ú
SetupState)ÚLiteral)ÚparserÚreturnc              	   C   sú  | j dddg d¢d� | j dddg d� |  dd	¡}|jd
dddddd� |  d¡}|jddddd� | j dddd� |jdddtdddd � |jd!d"d#d� |jd$d"d%d� |jd&d"d'd� |jd(d)td*d+d,� |jd-d"d.d/d0d1� |jd2dd3d4d5� |  d6d7¡}|jd8d9d:d"d;d� |jd<d"d=d� |jd>dd?d@dA� |jdBdd?dCdA� |jdDddEdFdA� |jdGdHd dItjtdGdJ�dKdL� |jdMd"dNd.dOdP� |jdQdRd"dSd.dTdP� |jdUd"dVd.dWdP� |jdXdYg dZ¢d[d\d]� |  d^d_¡}|jd`dad t	dIdbdc� d S )dNÚnorecursedirsz)directory patterns to avoid for recursionÚargs)	z*.eggz.*Ú_darcsÚbuildÚCVSÚdistZnode_modulesÚvenvz{arch})ÚtypeÚdefaultZ	testpathsz[directories to search for tests when no files or directories are given in the command line.Zgeneralzrunning and selection optionsz-xz--exitfirstÚstore_constÚmaxfailé   z-exit instantly on first error or failed test.)ÚactionÚdestÚconstÚhelpzpytest-warningsz-Wz--pythonwarningsÚappendz=set which warnings to report, see -W option of python itself.)r1   r4   ÚfilterwarningsZlinelistz_Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings.)r,   r4   z	--maxfailÚnumÚstorer   z(exit after first num failures or errors.)Úmetavarr1   r,   r2   r-   r4   z--strict-configÚ
store_truezcany warnings encountered while parsing the `pytest` section of the configuration file raise errors.z--strict-markerszWmarkers not registered in the `markers` section of the configuration file raise errors.z--strictz'(deprecated) alias to --strict-markers.z-cÚfileZinifilenamezcload configuration from `file` instead of trying to locate one of the implicit configuration files.)r9   r,   r2   r4   z--continue-on-collection-errorsFÚcontinue_on_collection_errorsz5Force test execution even if collection errors occur.)r1   r-   r2   r4   z	--rootdirÚrootdirz¶Define root directory for tests. Can be relative path: 'root_dir', './root_dir', 'root_dir/another_dir/'; absolute path: '/home/user/root_dir'; path with variables: '$HOME/root_dir'.)r1   r2   r4   ÚcollectÚ
collectionz--collectonlyz--collect-onlyz--coz'only collect tests, don't execute them.z--pyargsz2try to interpret all arguments as python packages.z--ignoreÚpathz.ignore path during collection (multi-allowed).)r1   r9   r4   z--ignore-globz6ignore path pattern during collection (multi-allowed).z
--deselectZnodeid_prefixzEdeselect item (via node id prefix) during collection (multi-allowed).z--confcutdirZ
confcutdirÚdir)Úoptnamez2only load conftest.py's relative to specified dir.)r2   r-   r9   r,   r4   z--noconftestZ
noconftestz!Don't load any conftest.py files.)r1   r2   r-   r4   z--keepduplicatesz--keep-duplicatesÚkeepduplicateszKeep duplicate tests.z--collect-in-virtualenvÚcollect_in_virtualenvz2Don't ignore tests in a local virtualenv directoryz--import-modeÚprepend)rE   r5   Ú	importlibÚ
importmodezaprepend/append to sys.path when importing test modules and conftest files, default is to prepend.)r-   Úchoicesr2   r4   Zdebugconfigz(test session debugging and configurationz
--basetempZbasetempz\base temporary directory for this test run.(warning: this directory is removed if it exists))r2   r-   r,   r9   r4   )
ZaddiniZgetgroupZ
_addoptionZ	addoptionÚintÚstrÚ	functoolsÚpartialr   Úvalidate_basetemp)r#   Úgroup© rO   úF/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/_pytest/main.pyÚpytest_addoption3   s0   üûú
üýù	ýýÿûûü	ûýüüüúûúûû	ùrQ   ©r@   r$   c                 C   sl   d}| st  |¡‚tttdœdd„}|t ¡ t| ƒ ¡ ƒrDt  |¡‚|t ¡  ¡ t| ƒ ¡ ƒrht  |¡‚| S )NzWbasetemp must not be empty, the current working directory or any parent directory of it)ÚbaseÚqueryr$   c                 S   s*   | |krdS | j D ]}||kr dS qdS )z,Return whether query is an ancestor of base.TF)Úparents)rS   rT   ÚparentrO   rO   rP   Úis_ancestorì   s    
z&validate_basetemp.<locals>.is_ancestor)ÚargparseÚArgumentTypeErrorr   ÚboolÚcwdÚabsoluteÚresolve)r@   ÚmsgrW   rO   rO   rP   rM   ä   s    



rM   ÚSession)ÚconfigÚdoitr$   c                 C   sà  t  | ¡}tj|_d}�z0z4|  ¡  d}| jj|d� d}|| |ƒpFd|_W �nh tyl   tj	|_‚ Y �nL t
y†   tj|_Y �n2 ttjf�y   tjj ¡ }tj}t|jtjƒrô|jjdurÎ|jj}|dk rôtj |j› d|jj› d�¡ | jj|d� ||_Y n¬ t�y¶   tj|_tjj ¡ }z|  || j ¡ W nV tj�y– } z:|jdu�rh|j|_tj d	 !t"|ƒj#|¡¡ W Y d}~n$d}~0 0 t|jt$ƒ�r²tj d
¡ Y n0 W d}|j% &¡  |dk�r@z| jj'||jd� W nV tj�y> } z:|jdu�r|j|_tj d	 !t"|ƒj#|¡¡ W Y d}~n
d}~0 0 |  (¡  n�d}|j% &¡  |dk�rÐz| jj'||jd� W nV tj�yÎ } z:|jdu�r |j|_tj d	 !t"|ƒj#|¡¡ W Y d}~n
d}~0 0 |  (¡  0 |jS )zSkeleton command line program.r   r0   ©Úsessioné   Nz: Ú
)Úexcinfoz{}: {}
z(mainloop: caught unexpected SystemExit!
)rc   Ú
exitstatus))r_   Úfrom_configr   ÚOKrg   Z_do_configureÚhookZpytest_sessionstartr   ZUSAGE_ERRORÚFailedÚTESTS_FAILEDÚKeyboardInterruptr   Ú	ExceptionÚ_pytestÚ_codeZExceptionInfoZfrom_currentZINTERRUPTEDÚ
isinstanceÚvalueÚ
returncodeÚsysÚstderrÚwriteÚtypenamer^   Zpytest_keyboard_interruptÚBaseExceptionÚINTERNAL_ERRORZnotify_exceptionÚoptionÚformatr,   Ú__name__Ú
SystemExitÚstartdirÚchdirZpytest_sessionfinishZ_ensure_unconfigure)r`   ra   rc   Z	initstaterf   rg   ÚexcrO   rO   rP   Úwrap_session   sz    

0

ÿ
0
õ

ÿ
0
r�   ©r`   r$   c                 C   s
   t | tƒS ©N)r�   Ú_main)r`   rO   rO   rP   Úpytest_cmdline_main;  s    r…   )r`   rc   r$   c                 C   s<   | j j|d� | j j|d� |jr(tjS |jdkr8tjS dS )z[Default command line protocol for initialization, session,
    running tests and reporting.rb   r   N)rj   Úpytest_collectionÚpytest_runtestloopÚtestsfailedr   rl   ÚtestscollectedZNO_TESTS_COLLECTED)r`   rc   rO   rO   rP   r„   ?  s    
r„   )rc   r$   c                 C   s   |   ¡  d S rƒ   )Úperform_collectrb   rO   rO   rP   r†   L  s    r†   c                 C   s²   | j r2| jjjs2|  d| j | j dkr(dndf ¡‚| jjjr@dS t| jƒD ]b\}}|d t| jƒk rr| j|d  nd }|jj	j
||d� | jrš|  | j¡‚| jrJ|  | j¡‚qJdS )Nz%d error%s during collectionr0   ÚsÚ T)ÚitemÚnextitem)rˆ   r`   rz   r<   ÚInterruptedZcollectonlyÚ	enumerateÚitemsÚlenrj   Zpytest_runtest_protocolÚ
shouldfailrk   Ú
shouldstop)rc   Úir�   rŽ   rO   rO   rP   r‡   P  s     ÿÿ
$r‡   c                    sD   |   tj d¡rdnd¡}| ¡ s&dS d‰ t‡ fdd„| ¡ D ƒƒS )zˆAttempt to detect if ``path`` is the root of a Virtual Environment by
    checking for the existence of the appropriate activate script.ÚwinZScriptsÚbinF)Úactivatezactivate.cshzactivate.fishZActivatezActivate.batzActivate.ps1c                    s   g | ]}|j ˆ v ‘qS rO   )Úbasename)Ú.0Úfname©Z	activatesrO   rP   Ú
<listcomp>r  ó    z_in_venv.<locals>.<listcomp>)Újoinrt   ÚplatformÚ
startswithÚisdirÚanyÚlistdir)r@   ZbindirrO   rœ   rP   Ú_in_venvd  s
    r¥   )r@   r`   r$   c                    sÄ   |j dˆ  ¡ d�}|pg }| d¡}|r<| dd„ |D ƒ¡ tj ˆ ¡|v rPdS |j dˆ  ¡ d�}|phg }| d¡}|rŒ| d	d„ |D ƒ¡ t‡ fd
d„|D ƒƒr¦dS | d¡}|sÀtˆ ƒrÀdS d S )NZcollect_ignore©r@   Úignorec                 S   s   g | ]}t j |¡‘qS rO   ©Úpyr@   Úlocal©rš   ÚxrO   rO   rP   r�   z  rž   z)pytest_ignore_collect.<locals>.<listcomp>TZcollect_ignore_globZignore_globc                 S   s   g | ]}t j |¡‘qS rO   r¨   r«   rO   rO   rP   r�   …  rž   c                 3   s"   | ]}t   tˆ ƒt|ƒ¡V  qd S rƒ   )ÚfnmatchrJ   )rš   Úglobr¦   rO   rP   Ú	<genexpr>‡  rž   z(pytest_ignore_collect.<locals>.<genexpr>rD   )	Z_getconftest_pathlistÚdirpathÚ	getoptionÚextendr©   r@   rª   r£   r¥   )r@   r`   Zignore_pathsZ
excludeoptZignore_globsZexcludegloboptZallow_in_venvrO   r¦   rP   Úpytest_ignore_collectu  s(    
ÿ

r³   )r‘   r`   r$   c                 C   sp   t | d¡pg ƒ}|sd S g }g }| D ]&}|j |¡rB| |¡ q&| |¡ q&|rl|jj|d� || d d …< d S )NZdeselect)r‘   )Útupler±   Únodeidr¡   r5   rj   Zpytest_deselected)r‘   r`   Zdeselect_prefixesÚ	remainingZ
deselectedZcolitemrO   rO   rP   Úpytest_collection_modifyitems�  s    r·   c                   @   s*   e Zd Zeddœdd„Zedœdd„ZdS )ÚFSHookProxyN)Úpmr$   c                 C   s   || _ || _d S rƒ   )r¹   Úremove_mods)Úselfr¹   rº   rO   rO   rP   Ú__init__£  s    zFSHookProxy.__init__©Únamec                 C   s    | j j|| jd�}|| j|< |S )N)Zremove_plugins)r¹   Zsubset_hook_callerrº   Ú__dict__)r»   r¾   r¬   rO   rO   rP   Ú__getattr__§  s    
zFSHookProxy.__getattr__)r|   Ú
__module__Ú__qualname__r   r¼   rJ   rÀ   rO   rO   rO   rP   r¸   ¢  s   r¸   c                   @   s   e Zd ZdZdZdS )r�   z*Signals that the test run was interrupted.ÚbuiltinsN©r|   rÁ   rÂ   Ú__doc__rO   rO   rO   rP   r�   ­  s   r�   c                   @   s   e Zd ZdZdS )rk   z"Signals a stop as failed test run.NrÄ   rO   rO   rO   rP   rk   ³  s   rk   c                   @   s(   e Zd Zejed�Zeedœdd„ZdS )Ú_bestrelpath_cache)r,   rR   c                 C   s   t | j|ƒ}|| |< |S rƒ   )r   r@   )r»   r@   ÚrrO   rO   rP   Ú__missing__»  s    z_bestrelpath_cache.__missing__N)	r|   rÁ   rÂ   ÚattrÚibr   r@   rJ   rÈ   rO   rO   rO   rP   rÆ   ·  s   rÆ   c                       sÔ  e Zd ZU eZeZeed< eed< ee	e
f ed< eddœ‡ fdd„Zeed dœdd	„ƒZed
œdd„Zeedœdd„Zedd�dd
œdd„ƒZedd�eeef ddœdd„ƒZeZejjedœdd„Zejjdœdd„Zdedœdd „Zd0ejjee e!j" d!œd"d#„Z#e$d1e%e e  d%e e!j& d&œd'd(„ƒZ'e$d2e%e e  ee ee!j&e!j"f  d&œd)d(„ƒZ'd3e%e e  ee ee!j&e!j"f  d&œd*d(„Z'e(ee!j&e!j"f  d
œd+d,„Z)ee!j&e!j"f e(e!j& d-œd.d/„Z*‡  Z+S )4r_   Z_setupstateZ_fixturemanagerrg   Nr‚   c                    sr   t ƒ j|jd || dd� d| _d| _d| _d| _|jj 	d¡| _|j
| _tƒ | _t|jƒ| _| jjj| dd� d S )NrŒ   )rV   r`   rc   rµ   r   Fr?   rc   r½   )Úsuperr¼   r=   rˆ   r‰   r”   r“   ÚtraceÚrootÚgetZinvocation_dirr~   Ú	frozensetÚ_initialpathsrÆ   ZrootpathÚ_bestrelpathcacher`   ÚpluginmanagerÚregister)r»   r`   ©Ú	__class__rO   rP   r¼   Ë  s    ÿzSession.__init__c                 C   s   |   |¡}|S rƒ   )Ú_create)Úclsr`   rc   rO   rO   rP   rh   Û  s    
zSession.from_config)r$   c                 C   s$   d| j j| jt| ddƒ| j| jf S )Nz6<%s %s exitstatus=%r testsfailed=%d testscollected=%d>rg   z<UNSET>)rÕ   r|   r¾   Úgetattrrˆ   r‰   ©r»   rO   rO   rP   Ú__repr__à  s    
ûzSession.__repr__)Ú	node_pathr$   c                 C   s
   | j | S rƒ   )rÑ   )r»   rÛ   rO   rO   rP   Ú_node_location_to_relpathé  s    z!Session._node_location_to_relpathT)Ztryfirstc                 C   s(   | j r|  | j ¡‚| jr$|  | j¡‚d S rƒ   )r“   rk   r”   r�   rÙ   rO   rO   rP   Úpytest_collectstartí  s    zSession.pytest_collectstart)Úreportr$   c                 C   sH   |j rDt|dƒsD|  jd7  _| j d¡}|rD| j|krDd| j | _d S )NZwasxfailr0   r/   zstopping after %d failures)ÚfailedÚhasattrrˆ   r`   Úgetvaluer“   )r»   rÞ   r/   rO   rO   rP   Úpytest_runtest_logreportô  s
    z Session.pytest_runtest_logreportrR   c                 C   s
   || j v S rƒ   )rÐ   )r»   r@   rO   rO   rP   Ú
isinitpath   s    zSession.isinitpath)Úfspathc                 C   sD   | j j}| || j  d¡¡}|j |¡}|r8t||ƒ}n| j j}|S )NrG   )r`   rÒ   Z_getconftestmodulesr±   Z_conftest_pluginsÚ
differencer¸   rj   )r»   rä   r¹   Zmy_conftestmodulesrº   ÚproxyrO   rO   rP   Úgethookproxy  s    ÿzSession.gethookproxyzos.DirEntry[str])Údirentryr$   c                    sh   |j dkrdS tj |j¡‰ |  ˆ  ¡ ¡}|jˆ | jd�r>dS | j d¡}t	‡ fdd„|D ƒƒrddS dS )NÚ__pycache__F©r@   r`   r%   c                 3   s   | ]}ˆ j |d �V  qdS ))r­   N)Úcheck)rš   Úpatr¦   rO   rP   r¯     rž   z#Session._recurse.<locals>.<genexpr>T)
r¾   r©   r@   rª   rç   r°   r³   r`   Zgetinir£   )r»   rè   ÚihookZnorecursepatternsrO   r¦   rP   Ú_recurse  s    
zSession._recurse)r@   Úhandle_dupesr$   c                 C   s’   |  ¡ s(J d || ¡ | ¡ | ¡ ¡ƒ‚|  |¡}|  |¡sP|j|| jd�rPdS |r„| j 	d¡}|s„| jj
j}||v rzdS | |¡ |j|| d�S )Nz9{!r} is not a file (isdir={!r}, exists={!r}, islink={!r})rê   rO   rC   )r@   rV   )Úisfiler{   r¢   ÚexistsÚislinkrç   rã   r³   r`   r±   rÒ   Z_duplicatepathsÚaddZpytest_collect_file)r»   r@   rï   rí   rC   Zduplicate_pathsrO   rO   rP   Ú_collectfile  s$    ÿÿþ



zSession._collectfile.zLiteral[True])r&   Úgenitemsr$   c                 C   s   d S rƒ   rO   ©r»   r&   rõ   rO   rO   rP   rŠ   7  s    zSession.perform_collectc                 C   s   d S rƒ   rO   rö   rO   rO   rP   rŠ   =  s    c              	   C   s˜  |du r| j j}|  d| |¡ | jj jd7  _g | _g | _g | _| j j}| j}�z(g }|D ]<}t	| j j
j|| j jjd�\}}| j ||f¡ | |¡ q\t|ƒ| _t| ƒ}	| jj|	d� | jj jd8  _| j�rg }
| jD ]0\}}d|›d|›d�}|
 d	|› d
|› �¡ qÞt|
Ž ‚|�s&|	j}n(|	j�rN|	jD ]}| j |  |¡¡ �q4| j j ¡  |j| | j |d� W |j| d� n|j| d� 0 t|ƒ| _|S )a°  Perform the collection phase for this session.

        This is called by the default
        :func:`pytest_collection <_pytest.hookspec.pytest_collection>` hook
        implementation; see the documentation of this hook for more details.
        For testing purposes, it may also be called directly on a fresh
        ``Session``.

        This function normally recursively expands any collectors collected
        from the session to their items, and only items are returned. For
        testing purposes, this may be suppressed by passing ``genitems=False``,
        in which case the return value contains these collectors unexpanded,
        and ``session.items`` is empty.
        NrŠ   r0   ©Ú	as_pypath©rÞ   z	(no name z in any of ú)znot found: re   )rc   r`   r‘   rb   )r`   r&   rÌ   rÍ   ÚindentÚ	_notfoundÚ_initial_partsr‘   rj   Úresolve_collection_argumentZinvocation_paramsrA   rz   Zpyargsr5   rÏ   rÐ   r    rí   Úpytest_collectreportr   ÚresultÚpassedr²   rõ   rÒ   Zcheck_pendingr·   Zpytest_collection_finishr’   r‰   )r»   r&   rõ   rj   r‘   ZinitialpathsÚargrä   ÚpartsÚrepÚerrorsÚcolsÚlineÚnoderO   rO   rP   rŠ   C  sR    ý


ÿ
c              	   c   sv  ddl m} i }i }i }i }| jD �]L\}}|  d||f¡ | jj jd7  _| j dd¡sò| jj}t	| 
¡ ƒD ]€}	|jrŠ|j |	¡rŠ qò|	 ¡ rp|	 d¡}
|
 ¡ rp|
|vrp| j|
dd�}|rpt|d |ƒrÜ|d |t|	ƒ< |d g||d j< qp|jdd	��r|�rJ d
 ||f¡ƒ‚tƒ }tt|ƒ| jƒD ]Ø}| ¡ �s@�q.tj |j¡}| ¡ }||v�r®| |¡ | d¡}
|
 ¡ �r®|  |
¡D ]$}|V  t||ƒ�rˆ||t|ƒ< �qˆt|ƒ|v �rÀ�q.|  |¡D ]8}t |ƒ|jf}||v �rò|| V  n|||< |V  �qÊ�q.�nR|jdd��sJ ‚||v �r2|| }n*| !|j"| ¡}|j|dd�}|�r\|||< g }||fg}|�rØ|  d||¡ | jj jd7  _| #¡ \}}|D �]}|�sº| $|¡ �q t|t%j&ƒ�sÌ�q t |ƒ|j'f}||v �rî|| }nt(|ƒ}|||< |j)�ržg }|j*D ]:}|j+|d k�s>|j+ ,d¡d |d k�r| $|¡ �q|�rj| $||dd … f¡ n2t-|j*ƒdk�r¬|j*d j+dk�r¬| $|j*|f¡ n|j.j/|d� �q |  dt-|ƒd¡ | jj jd8  _�qj|�sd t|ƒg|¢R ¡}| j0 $||f¡ q"|j1dk�rTt|d |ƒ�rTzt2t3|d  4¡ ƒƒV  W q" t5�yP   Y q"0 q"|E d H  | jj jd8  _q"d S )Nr   )ÚPackagezprocessing argumentr0   ZdoctestmodulesFz__init__.py)rï   )rA   zinvalid arg {!r})r;   Ú
matchnodesú[z()rù   zmatchnodes finished -> r   ú::)6Z_pytest.pythonr	  rý   rÌ   rÍ   rû   r`   r±   rÒ   Úreversedr  Z_confcutdirZreltor¢   rŸ   rð   rô   rq   rJ   rä   rë   r{   Úsetr   rî   Úis_filer©   r@   rª   r°   ró   rñ   r,   rÎ   ÚdirnameÚpopr5   r   Ú	Collectorrµ   r    r  r   r¾   Úsplitr’   rí   rÿ   rü   r™   ÚnextÚiterr>   ÚStopIteration)r»   r	  Znode_cache1Znode_cache2Zmatchnodes_cacheZ	pkg_rootsZargpathÚnamesr¹   rV   ZpkginitÚcolZ	seen_dirsrè   r@   r°   r¬   ÚkeyZcollect_rootZmatchingZworkr
  Z
matchnamesr  r  ZsubmatchnodesrÇ   Z
report_argrO   rO   rP   r>   †  sÈ    þ








þ




ÿþ"ÿ
zSession.collect)r  r$   c                 c   sz   |   d|¡ t|tjƒr.|jj|d� |V  nHt|tjƒs>J ‚t|ƒ}|jrh|j	D ]}|  
|¡E d H  qR|jj|d� d S )Nrõ   )r�   rù   )rÌ   rq   r   ÚItemrí   Zpytest_itemcollectedr  r    r  r   rõ   rÿ   )r»   r  r  ZsubnoderO   rO   rP   rõ     s    
zSession.genitems)T)..)..)NT),r|   rÁ   rÂ   r�   rk   r!   Ú__annotations__r   r   rI   r   r   r¼   Úclassmethodrh   rJ   rÚ   r   rÜ   r   rÝ   r   r   râ   rÿ   r©   r@   rª   rZ   rã   rç   rî   r
   r   r  rô   r	   r   r  rŠ   r   r>   rõ   Ú__classcell__rO   rO   rÔ   rP   r_   Á  s^   
	
þ	 ÿþ ÿþ ÿþ ÿþC þ)Úmodule_namer$   c              
   C   sl   zt j | ¡}W n tttfy,   |  Y S 0 |du sJ|jdu sJ|jdkrN| S |jrbtj	 
|j¡S |jS dS )zTSearch sys.path for the given a dotted module name, and return its file system path.NÚ	namespace)rF   ÚutilÚ	find_specÚAttributeErrorÚImportErrorÚ
ValueErrorÚoriginÚsubmodule_search_locationsÚosr@   r  )r  ÚspecrO   rO   rP   Úsearch_pypath/  s    
r)  Fr÷   )Úinvocation_pathr  rø   r$   c                C   sŽ   t |ƒ d¡^}}|rt|ƒ}| | }t|ƒ}| ¡ sR|r>dnd}t|j|d�ƒ‚|rz| ¡ rz|rfdnd}t|j|d�ƒ‚tj	 
t |ƒ¡|fS )ah  Parse path arguments optionally containing selection parts and return (fspath, names).

    Command-line arguments can point to files and/or directories, and optionally contain
    parts for specific tests selection, for example:

        "pkg/tests/test_foo.py::TestClass::test_foo"

    This function ensures the path exists, and returns a tuple:

        (py.path.path("/full/path/to/pkg/tests/test_foo.py"), ["TestClass", "test_foo"])

    When as_pypath is True, expects that the command-line argument actually contains
    module paths instead of file-system paths:

        "pkg.tests.test_foo::TestClass::test_foo"

    In which case we search sys.path for a matching module, and then return the *path* to the
    found module.

    If the path doesn't exist, raise UsageError.
    If the path is a directory and selection parts are present, raise UsageError.
    r  z9module or package not found: {arg} (missing __init__.py?)z"file or directory not found: {arg})r  z9package argument cannot contain :: selection parts: {arg}z;directory argument cannot contain :: selection parts: {arg})rJ   r  r)  r   rñ   r   r{   Úis_dirr©   r@   rª   )r*  r  rø   Zstrpathr  rä   r^   rO   rO   rP   rþ   @  s$    ÿýÿýrþ   )RrÅ   rX   r­   rK   rF   r'  rt   Úpathlibr   Útypingr   r   r   r   r   r   r	   r
   r   r   r   r   r   rÉ   r©   Z_pytest._codero   r   Z_pytest.compatr   Z_pytest.configr   r   r   r   r   r   Z_pytest.config.argparsingr   Z_pytest.fixturesr   Z_pytest.outcomesr   Z_pytest.pathlibr   r   r   Z_pytest.reportsr   r   Z_pytest.runnerr    r!   Ztyping_extensionsr"   rQ   rJ   rM   rI   r�   r…   r„   r†   rZ   r‡   r@   rª   r¥   r³   r  r·   r¸   rm   r�   rn   rk   r‹   rÆ   ZFSCollectorr_   r)  rþ   rO   rO   rO   rP   Ú<module>   sŽ    2
þ;	  oÿþ