U
    `»{j(’  ã                   @  st  d Z ddlm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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m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l0m1Z1 ddl0m2Z2 dd l3m4Z4 dd!l3m5Z5 dd"l6m7Z7 e�rúdd#l8m9Z9 dd$l:m;Z; d%d&d'œd(d)„Z<d*d*d+œd,d-„Z=d.d/d0d1œd2d3„Z>d.d0d4œd5d6„Z?d.d7d8d9œd:d;„Z@d7d&d<œd=d>„ZAd7d?d<œd@dA„ZBdBd?d+œdCdD„ZCdBd.dEdFœdGdH„ZDdBdIdJdKœdLdM„ZEdNd.d&dOœdPdQ„ZFG dRdS„ dSƒZGG dTdU„ dUeHƒZIG dVdW„ dWeJƒZKejLG dXdY„ dYeeeMf ƒƒZNeG dZd[„ d[ejOƒƒZPeG d\d7„ d7ejQƒƒZRd*d]d^œd_d`„ZSejLdadb�G dcdd„ ddƒƒZTdedfœdBd*d?dddgœdhdi„ZUdS )jzHCore implementation of the testing process: init, session, runtest loop.é    )ÚannotationsN)ÚPath)ÚAbstractSet)ÚCallable)ÚDict)Úfinal)ÚIterable)ÚIterator)ÚLiteral)Úoverload)ÚSequence)ÚTYPE_CHECKING)Únodes)ÚConfig)Údirectory_arg)ÚExitCode)Úhookimpl)ÚPytestPluginManager)Ú
UsageError)ÚParser)ÚPathAwareHookProxy)Úexit©Úabsolutepath)Úbestrelpath©Ú
fnmatch_ex)Úsafe_exists)Úscandir)ÚCollectReport)Ú
TestReport)Úcollect_one_node)Ú
SetupState)ÚPytestWarning)ÚSelf)ÚFixtureManagerr   ÚNone)ÚparserÚreturnc                 C  s  | j ddddddddd	d
ddg	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d0d1d2td3d4d5� |jd6d*d7d8d9d:� |jd;d%d<d=d>� |  d?d@¡}|jdAdBdCd*dDd� |jdEd*dFd� |jdGddHdIdJ� |jdKddHdLdJ� |jdMddNdOdJ� |jdPdQd dRtjtdPdS�dTdU� |jdVd*dWd7dXdY� |jdZd[d*d\d7d]dY� |jd^d*d_d7d`dY� |jdadbdbddcgdddedf� | j dgdhd7didj� |  dkdl¡}|jdmdnd t	dRdodp� d S )qNÚnorecursedirsz)Directory patterns to avoid for recursionÚargsz*.eggz.*Z_darcsÚbuildZCVSÚdistZnode_modulesÚvenvz{arch})ÚtypeÚdefaultZ	testpathszZDirectories to search for tests when no files or directories are given on the command lineZ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)r3   r6   ÚfilterwarningsZlinelistz_Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings.)r.   r6   z	--maxfailÚnumÚstorer   z'Exit after first num failures or errors)Úmetavarr3   r.   r4   r/   r6   z--strict-configÚ
store_truezbAny warnings encountered while parsing the `pytest` section of the configuration file raise errorsz--strict-markerszVMarkers not registered in the `markers` section of the configuration file raise errorsz--strictz&(Deprecated) alias to --strict-markersz-cz--config-fileÚFILEZinifilenamezcLoad configuration from `FILE` instead of trying to locate one of the implicit configuration files.)r;   r.   r4   r6   z--continue-on-collection-errorsFÚcontinue_on_collection_errorsz4Force test execution even if collection errors occur)r3   r/   r4   r6   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'.)r3   r4   r6   ÚcollectÚ
collectionz--collectonlyz--collect-onlyz--coz&Only collect tests, don't execute themz--pyargsz1Try to interpret all arguments as Python packagesz--ignoreÚpathz-Ignore path during collection (multi-allowed))r3   r;   r6   z--ignore-globz5Ignore path pattern during collection (multi-allowed)z
--deselectZnodeid_prefixzDDeselect item (via node id prefix) during collection (multi-allowed)z--confcutdirZ
confcutdirÚdir)Úoptnamez1Only load conftest.py's relative to specified dir)r4   r/   r;   r.   r6   z--noconftestZ
noconftestz Don't load any conftest.py files)r3   r4   r/   r6   z--keepduplicatesz--keep-duplicatesÚkeepduplicateszKeep duplicate testsz--collect-in-virtualenvÚcollect_in_virtualenvz2Don't ignore tests in a local virtualenv directoryz--import-modeÚprependÚ	importlibZ
importmodez\Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.)r/   Úchoicesr4   r6   Zconsider_namespace_packagesÚboolzEConsider namespace packages when resolving module names during import)r.   r/   r6   Zdebugconfigz(test session debugging and configurationz
--basetempZbasetempz^Base temporary directory for this test run. (Warning: this directory is removed if it exists.))r4   r/   r.   r;   r6   )
ZaddiniZgetgroupZ
_addoptionZ	addoptionÚintÚstrÚ	functoolsÚpartialr   Úvalidate_basetemp)r'   Úgroup© rQ   úK/var/www/html/bwave/python/venv/lib/python3.8/site-packages/_pytest/main.pyÚpytest_addoption9   sT   ÷üûú
üýù	ýýýú	ûü	ûýüüüúûúûûüùrS   rL   ©rB   r(   c                 C  sl   d}| st  |¡‚ddddœdd„}|t ¡ t| ƒ ¡ ƒrDt  |¡‚|t ¡  ¡ t| ƒ ¡ ƒrht  |¡‚| S )NzWbasetemp must not be empty, the current working directory or any parent directory of itr   rJ   )ÚbaseÚqueryr(   c                 S  s   | |krdS || j kS )z,Return whether query is an ancestor of base.T)Úparents)rU   rV   rQ   rQ   rR   Úis_ancestorý   s    z&validate_basetemp.<locals>.is_ancestor)ÚargparseÚArgumentTypeErrorr   ÚcwdÚabsoluteÚresolve)rB   ÚmsgrX   rQ   rQ   rR   rO   õ   s    


rO   r   z2Callable[[Config, Session], int | ExitCode | None]úint | ExitCode)ÚconfigÚdoitr(   c                 C  s`  t  | ¡}tj|_d}�z¬z4|  ¡  d}| jj|d� d}|| |ƒpFd|_W �nr tk
rn   tj|_‚ Y �nT tk
rŠ   tj|_Y �n8 tt
jfk
�r   tjj ¡ }tj}t|j t
jƒrú|j jdk	rÔ|j j}|dk rútj |j!› d|j j"› d�¡ | jj#|d	� ||_Y n° t$k
�rÀ   tj%|_tjj ¡ }z|  &|| j'¡ W nX t
jk
�r  } z6|jdk	�rr|j|_tj t|ƒj› d|› d�¡ W 5 d}~X Y nX t|j t(ƒ�r¼tj d
¡ Y nX W 5 d}t |j¡ |dk�rPz| jj	||jd� W nX t
jk
�rN } z6|jdk	�r |j|_tj t|ƒj› d|› d�¡ W 5 d}~X Y nX |  ¡  X |jS )zSkeleton command line program.r   Né   )ÚsessionÚ
exitstatusz: Ú
r2   ©rc   )Úexcinfoz(mainloop: caught unexpected SystemExit!
))ÚSessionÚfrom_configr   ÚOKrd   ÚosÚchdirÚ	startpathÚhookZpytest_sessionfinishr   Ú	ExceptionÚ
returncodeÚsysÚstderrÚwriter.   Ú__name__Z_ensure_unconfigureZ_do_configureZpytest_sessionstartr   ZUSAGE_ERRORÚFailedÚTESTS_FAILEDÚKeyboardInterruptÚ_pytestÚ_codeZExceptionInfoZfrom_currentZINTERRUPTEDÚ
isinstanceÚvalueÚtypenamer^   Zpytest_keyboard_interruptÚBaseExceptionÚINTERNAL_ERRORZnotify_exceptionÚoptionÚ
SystemExit)r`   ra   rc   Z	initstaterg   Úexcrd   rQ   rQ   rR   Úwrap_session  sd    

0
 ÿ
0
r‚   ©r`   r(   c                 C  s
   t | tƒS ©N)r‚   Ú_main©r`   rQ   rQ   rR   Úpytest_cmdline_mainI  s    r‡   rh   zint | ExitCode | None)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.rf   r   N)rn   Úpytest_collectionÚpytest_runtestloopÚtestsfailedr   rv   ÚtestscollectedZNO_TESTS_COLLECTED)r`   rc   rQ   rQ   rR   r…   M  s    
r…   )rc   r(   c                 C  s   |   ¡  d S r„   )Úperform_collectrf   rQ   rQ   rR   rˆ   Z  s    rˆ   rJ   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 collectionr2   ÚsÚ T)ÚitemÚnextitem)rŠ   r`   r   r>   ÚInterruptedZcollectonlyÚ	enumerateÚitemsÚlenrn   Zpytest_runtest_protocolÚ
shouldfailru   Ú
shouldstop)rc   Úir�   r�   rQ   rQ   rR   r‰   ^  s     ÿÿ
$r‰   r   c                 C  s<   z |   d¡ ¡ p|   dd¡ ¡ W S  tk
r6   Y dS X dS )añ  Attempt to detect if ``path`` is the root of a Virtual Environment by
    checking for the existence of the pyvenv.cfg file.

    [https://peps.python.org/pep-0405/]

    For regression protection we also check for conda environments that do not include pyenv.cfg yet --
    https://github.com/conda/conda/issues/13337 is the conda issue tracking adding pyenv.cfg.

    Checking for the `conda-meta/history` file per https://github.com/pytest-dev/pytest/issues/12652#issuecomment-2246336902.

    z
pyvenv.cfgz
conda-metaÚhistoryFN)ÚjoinpathÚis_fileÚOSError©rB   rQ   rQ   rR   Ú_in_venvr  s    þr�   zbool | None)Úcollection_pathr`   r(   c                   sò   ˆ j dkrdS |jdˆ jd�}|p$g }| d¡}|rH| dd„ |D ƒ¡ ˆ |krTdS |jdˆ jd�}|pjg }| d	¡}|rŽ| d
d„ |D ƒ¡ t‡ fdd„|D ƒƒr¨dS | d¡}|sÂtˆ ƒrÂdS ˆ  ¡ rî| d¡}t‡ fdd„|D ƒƒrîdS d S )NÚ__pycache__TZcollect_ignorerœ   Úignorec                 s  s   | ]}t |ƒV  qd S r„   r   ©Ú.0ÚxrQ   rQ   rR   Ú	<genexpr>‘  s     z(pytest_ignore_collect.<locals>.<genexpr>Zcollect_ignore_globZignore_globc                 s  s   | ]}t |ƒV  qd S r„   r   r¡   rQ   rQ   rR   r¤   œ  s     c                 3  s"   | ]}t   tˆ ƒt|ƒ¡V  qd S r„   )ÚfnmatchrL   )r¢   Úglob©rž   rQ   rR   r¤   ž  s     rF   r)   c                 3  s   | ]}t |ˆ ƒV  qd S r„   r   )r¢   Úpatr§   rQ   rR   r¤   §  s     )	ÚnameZ_getconftest_pathlistÚparentÚ	getoptionÚextendÚanyr�   Úis_dirZgetini)rž   r`   Zignore_pathsZ
excludeoptZignore_globsZexcludegloboptZallow_in_venvZnorecursepatternsrQ   r§   rR   Úpytest_ignore_collect‡  s<    
 ÿ
 ÿ


r¯   únodes.Collectorznodes.Collector | None)rB   rª   r(   c                 C  s   t j|| d�S )Nrœ   )ÚDirÚfrom_parent©rB   rª   rQ   rQ   rR   Úpytest_collect_directory­  s    r´   zlist[nodes.Item])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«   ÚnodeidÚ
startswithr7   rn   Zpytest_deselected)r“   r`   Zdeselect_prefixesÚ	remainingZ
deselectedZcolitemrQ   rQ   rR   Úpytest_collection_modifyitems³  s    r¹   c                   @  s.   e Zd Zddddœdd„Zddd	œd
d„ZdS )ÚFSHookProxyr   zAbstractSet[object]r&   )ÚpmÚremove_modsr(   c                 C  s   || _ || _d S r„   )r»   r¼   )Úselfr»   r¼   rQ   rQ   rR   Ú__init__Æ  s    zFSHookProxy.__init__rL   zpluggy.HookCaller)r©   r(   c                 C  s    | j j|| jd�}|| j|< |S )N)Zremove_plugins)r»   Zsubset_hook_callerr¼   Ú__dict__)r½   r©   r£   rQ   rQ   rR   Ú__getattr__Î  s    
zFSHookProxy.__getattr__N)rt   Ú
__module__Ú__qualname__r¾   rÀ   rQ   rQ   rQ   rR   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©rt   rÁ   rÂ   Ú__doc__rQ   rQ   rQ   rR   r‘   Ô  s   r‘   c                   @  s   e Zd ZdZdS )ru   z"Signals a stop as failed test run.NrÄ   rQ   rQ   rQ   rR   ru   Ú  s   ru   c                   @  s*   e Zd ZU dZded< dddœdd„ZdS )	Ú_bestrelpath_cacherœ   r   rB   rL   rT   c                 C  s   t | j|ƒ}|| |< |S r„   )r   rB   )r½   rB   ÚrrQ   rQ   rR   Ú__missing__ä  s    z_bestrelpath_cache.__missing__N)rt   rÁ   rÂ   Ú	__slots__Ú__annotations__rÈ   rQ   rQ   rQ   rR   rÆ   Þ  s   
rÆ   c                      s<   e Zd ZdZeddddœ‡ fdd„ƒZdd	œd
d„Z‡  ZS )r±   a  Collector of files in a file system directory.

    .. versionadded:: 8.0

    .. note::

        Python directories with an `__init__.py` file are instead collected by
        :class:`~pytest.Package` by default. Both are :class:`~pytest.Directory`
        collectors.
    r°   r   r$   )rª   rB   r(   c                  s   t ƒ j||d�S )z¦The public constructor.

        :param parent: The parent collector of this Dir.
        :param path: The directory's path.
        :type path: pathlib.Path
        )rª   rB   )Úsuperr²   )Úclsrª   rB   ©Ú	__class__rQ   rR   r²   ÷  s    zDir.from_parentz&Iterable[nodes.Item | nodes.Collector]©r(   c                 c  s¶   | j }| j}t| jƒD ]š}| ¡ rjt|jƒ}| jj|dd�sL|j||d�rLq|j	|| d�}|d k	r°|V  q| 
¡ rt|jƒ}| j |¡s˜|j||d�r˜q|j|| d�}|E d H  qd S )NT©Úwith_parents)rž   r`   r³   ©Ú	file_pathrª   )r`   Úihookr   rB   r®   r   rc   Ú
isinitpathr¯   r´   rš   Úpytest_collect_file)r½   r`   rÔ   ZdirentryrB   ÚcolÚcolsrQ   rQ   rR   r@     s$    

zDir.collect)rt   rÁ   rÂ   rÅ   Úclassmethodr²   r@   Ú__classcell__rQ   rQ   rÍ   rR   r±   ê  s   r±   c                      sÄ  e Zd ZU dZeZeZded< ded< ded< dd	d
œ‡ fdd„Zedd d
œdd„ƒZ	ddœdd„Z
eddœdd„ƒZejdd	dœdd„ƒZeddœdd„ƒZejdd	dœdd„ƒZeddœdd„ƒZdddœdd „Zed!d"�d	dœd#d$„ƒZed!d"�d%d	d&œd'd(„ƒZeZd)d*œd+d,d,d-œd.d/„Zd0d1d2œd3d4„Zdd5d6d7œd8d9„ZedRd;d<d=d>œd?d@„ƒZedSd;d,dAd>œdBd@„ƒZdTd;d,dAd>œdDd@„ZdUdEd,dFdGœdHdI„ZdJdœdKdL„ZdMdNdOœdPdQ„Z‡  ZS )Vrh   zoThe root of the collection tree.

    ``Session`` collects the initial paths given as arguments to pytest.
    r"   Z_setupstater%   Z_fixturemanagerr_   rd   r   r&   rƒ   c              	     sŽ   t ƒ jd|jd d || dd� d| _d| _d| _d| _|jj 	d¡| _t
ƒ | _t
ƒ | _g | _g | _i | _g | _t|jƒ| _| jjj| dd� d S )NrŽ   )r©   rB   Úfspathrª   r`   rc   r¶   r   FrA   rc   )r©   )rË   r¾   ZrootpathrŠ   r‹   Ú_shouldstopÚ_shouldfailÚtraceÚrootÚgetÚ	frozensetÚ_initialpathsÚ_initialpaths_with_parentsÚ	_notfoundÚ_initial_partsÚ_collection_cacher“   rÆ   Ú_bestrelpathcacher`   ÚpluginmanagerÚregister)r½   r`   rÍ   rQ   rR   r¾   -  s,    ù	zSession.__init__c                 C  s   | j |d�}|S )Nr†   )Ú_create)rÌ   r`   rc   rQ   rQ   rR   ri   G  s    zSession.from_configrL   rÏ   c                 C  s$   d| j j| jt| ddƒ| j| jf S )Nz6<%s %s exitstatus=%r testsfailed=%d testscollected=%d>rd   z<UNSET>)rÎ   rt   r©   ÚgetattrrŠ   r‹   ©r½   rQ   rQ   rR   Ú__repr__L  s    
ûzSession.__repr__z
bool | strc                 C  s   | j S r„   )rÜ   rì   rQ   rQ   rR   r–   U  s    zSession.shouldstop)r{   r(   c                 C  s.   |dkr$| j r$tjtdƒdd� d S || _ d S )NFzCsession.shouldstop cannot be unset after it has been set; ignoring.rb   ©Ú
stacklevel)rÜ   ÚwarningsÚwarnr#   ©r½   r{   rQ   rQ   rR   r–   Y  s    ÿüc                 C  s   | j S r„   )rÝ   rì   rQ   rQ   rR   r•   g  s    zSession.shouldfailc                 C  s.   |dkr$| j r$tjtdƒdd� d S || _ d S )NFzCsession.shouldfail cannot be unset after it has been set; ignoring.rb   rî   )rÝ   rð   rñ   r#   rò   rQ   rQ   rR   r•   k  s    ÿür   c                 C  s
   | j jjS )zQThe path from which pytest was invoked.

        .. versionadded:: 7.0.0
        )r`   Úinvocation_paramsrC   rì   rQ   rQ   rR   rm   y  s    zSession.startpath)Ú	node_pathr(   c                 C  s
   | j | S r„   )rç   )r½   rô   rQ   rQ   rR   Ú_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•   ru   r–   r‘   rì   rQ   rQ   rR   Úpytest_collectstart…  s    zSession.pytest_collectstartzTestReport | CollectReport)Úreportr(   c                 C  sH   |j rDt|dƒsD|  jd7  _| j d¡}|rD| j|krDd| j | _d S )NZwasxfailr2   r1   zstopping after %d failures)ZfailedÚhasattrrŠ   r`   Úgetvaluer•   )r½   r÷   r1   rQ   rQ   rR   Úpytest_runtest_logreportŒ  s
    z Session.pytest_runtest_logreportFrÐ   zstr | os.PathLike[str]rJ   )rB   rÑ   r(   c                C  s2   t |tƒr|nt|ƒ}|r$|| jkS || jkS dS )a>  Is path an initial path?

        An initial path is a path explicitly given to pytest on the command
        line.

        :param with_parents:
            If set, also return True if the path is a parent of an initial path.

        .. versionchanged:: 8.0
            Added the ``with_parents`` parameter.
        N)rz   r   rã   râ   )r½   rB   rÑ   Zpath_rQ   rQ   rR   rÕ   –  s    
zSession.isinitpathzos.PathLike[str]zpluggy.HookRelay)rÛ   r(   c                 C  sT   t |tƒr|nt|ƒ}| jj}| |¡}|j |¡}|rHtt||ƒƒ}n| jj	}|S r„   )
rz   r   r`   rè   Z_getconftestmodulesZ_conftest_pluginsÚ
differencer   rº   rn   )r½   rÛ   rB   r»   Zmy_conftestmodulesr¼   ÚproxyrQ   rQ   rR   Úgethookproxy®  s    
zSession.gethookproxyz%dict[Path, Sequence[nodes.Collector]]zSequence[nodes.Collector])rB   Ú
path_cacher(   c                 C  sx   ||kr|| S |  ¡ rF|  |j¡}|j|| d�}|dk	r@|fnd}n&| ¡ rh|  |¡}|j|| d�}nd}|||< |S )z�Create a Collector for the given path.

        `path_cache` makes it so the same Collectors are returned for the same
        path.
        r³   NrQ   rÒ   )r®   rý   rª   r´   rš   rÖ   )r½   rB   rþ   rÔ   r×   rØ   rQ   rQ   rR   Ú_collect_path¿  s    
 ÿ
zSession._collect_path.zSequence[str] | NonezLiteral[True]zSequence[nodes.Item])r*   Úgenitemsr(   c                 C  s   d S r„   rQ   ©r½   r*   r   rQ   rQ   rR   rŒ   Þ  s    zSession.perform_collectz&Sequence[nodes.Item | nodes.Collector]c                 C  s   d S r„   rQ   r  rQ   rQ   rR   rŒ   ã  s    Nc              	   C  sÖ  |dkr| j j}|  d| |¡ | jj jd7  _| j j}g | _g | _i | _g | _	| j	}�zHg }g }|D ]P}t| j jj|| j jjd�}| j |¡ | |j¡ | |j¡ | |jj¡ qft|ƒ| _t|ƒ| _t| ƒ}	| jj|	d� | jj jd8  _| j�rJg }
| jD ]:\}}|�r.|
 d|› d|›d	�¡ n|
 d
|› �¡ �qt|
Ž ‚|�sX|	j}n(|	j�r€|	jD ]}| j	 |  |¡¡ �qf| j j ¡  |j | | j |d� W 5 g | _g | _i | _|j
| d� X |�rÒt!|ƒ| _"|S )aƒ  Perform the collection phase for this session.

        This is called by the default :hook:`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Œ   r2   rf   ©Ú	as_pypath©r÷   znot found: z
(no match in any of ú)zfound no collectors for )rc   r`   r“   )#r`   r*   rÞ   rß   Úindentrn   rä   rå   ræ   r“   Zpytest_collection_finishÚresolve_collection_argumentró   rC   r   Zpyargsr7   rB   r¬   rW   rá   râ   rã   r!   rÔ   Úpytest_collectreportr   ÚresultÚpassedr   rè   Zcheck_pendingr¹   r”   r‹   )r½   r*   r   rn   r“   ZinitialpathsZinitialpaths_with_parentsÚargÚcollection_argumentÚrepÚerrorsZ
collectorsÚnoderQ   rQ   rR   rŒ   è  sn    ý

ÿ
  ÿ

r°   ztuple[CollectReport, bool])r  Úhandle_dupesr(   c                 C  s>   || j kr |r | j | }|dfS t|ƒ}|| j |< |dfS d S )NTF)ræ   r!   )r½   r  r  r  rQ   rQ   rR   Ú_collect_one_node:  s    

zSession._collect_one_nodez&Iterator[nodes.Item | nodes.Collector]c                 c  sä  i }| j j}| jD �]Ê}|  d|¡ | jj jd7  _|j}|j}|j}| 	¡ rf|rft
d||f›�ƒ‚|g}|d krœ|jD ]}| |¡sŒ qè| d|¡ qznL| d¡}	t|jdƒD ]4\}
}|
t|	ƒksÖ|j|	|
  krÚ qè| d|¡ q²d}g }| ||•fg}|�r¢| ¡ \}}|�s"|V  d}qþt|tjƒ�s2qþt|tƒ�rdt|d tƒ�sRt
‚| |d |¡}nht|ƒdk�oŒt|d tƒ�oŒ|d  ¡  }|  ||¡\}}|�s¼|j�s¼|jj|d	� |j�sÆqþ|j}d}t|ƒD ]¸}t|d tƒ�rF|j|d k}t j!d
k�rn|�snt"j #|j|d ¡}|�oBt"j $|j¡t"j $|d ¡k}n(|j%|d k�pl|j% d¡d |d k}|�rØ| &||dd … f¡ d}�qØ|sþ| &|¡ qþ|�sÌd 't(|ƒf|˜¡}| j) &||f¡ | jj jd8  _qd S )Nzprocessing argumentr2   zinvalid arg r   Ú.rb   FTr  Úwin32ú[ú::)*r`   rè   rå   rÞ   rß   r  rB   ÚpartsÚmodule_namer®   ÚAssertionErrorrW   Z_is_in_confcutdirÚinsertÚsplitr’   r”   ÚstemÚpoprz   r   Ú	Collectorrh   r   rÿ   rš   r  r
  rÔ   r  r	  Úreversedrq   Úplatformrk   ÚsamefileÚislinkr©   r7   ÚjoinrL   rä   )r½   rþ   r»   r  ZargpathÚnamesr  ÚpathsrB   Zmodule_name_partsr—   Zany_matched_in_initial_partZnotfound_collectorsZworkZ	matchnodeZ
matchpartsZsubnodesr  r  Ú	duplicateZany_matched_in_collectorr  Zis_matchZ	same_fileZ
report_argrQ   rQ   rR   r@   G  sŒ    



ÿÿ
ýÿÿ
þzSession.collectznodes.Item | nodes.CollectorzIterator[nodes.Item])r  r(   c                 c  s°   |   d|¡ t|tjƒr.|jj|d� |V  n~t|tjƒs>t‚| j 	d¡}|oXt|tj
ƒ }|  ||¡\}}|rx|sxd S |jrš|jD ]}|  |¡E d H  q„|s¬|jj|d� d S )Nr   )r�   rE   r  )rÞ   rz   r   ZItemrÔ   Zpytest_itemcollectedr  r  r`   r«   ÚFiler  r
  r	  r   r  )r½   r  rE   r  r  r%  ZsubnoderQ   rQ   rR   r   À  s    
zSession.genitems)..)..)NT)T)rt   rÁ   rÂ   rÅ   r‘   ru   rÊ   r¾   rÙ   ri   rí   Úpropertyr–   Úsetterr•   rm   rõ   r   rö   rú   r  rÕ   rý   rÿ   r   rŒ   r  r@   r   rÚ   rQ   rQ   rÍ   rR   rh     sZ   
	ü   ÿ   ÿ   ÿU ýyú
str | None)r  r(   c              
   C  sl   zt j | ¡}W n tttfk
r,   Y dS X |dksJ|jdksJ|jdkrNdS |jrbtj	 
|j¡S |jS dS )zaSearch sys.path for the given a dotted module name, and return its file
    system path if found.NÚ	namespace)rH   ÚutilÚ	find_specÚAttributeErrorÚImportErrorÚ
ValueErrorÚoriginÚsubmodule_search_locationsrk   rB   Údirname)r  ÚspecrQ   rQ   rR   Úsearch_pypathÔ  s    r4  T)Úfrozenc                   @  s*   e Zd ZU dZded< ded< ded< dS )	ÚCollectionArgumentzA resolved collection argument.r   rB   zSequence[str]r  r)  r  N)rt   rÁ   rÂ   rÅ   rÊ   rQ   rQ   rQ   rR   r6  æ  s   
r6  Fr  )Úinvocation_pathr  r  r(   c                C  sÈ   t |ƒ d¡\}}}| d¡^}}|r>|d › |› |› �|d< d}|r^t|ƒ}	|	dk	r^|}|	}| | }
t|
ƒ}
t|
ƒs’|r~dnd}t|j|d�ƒ‚|rº|
 ¡ rº|r¦dnd	}t|j|d�ƒ‚t	|
||d
�S )aÃ  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 resolved `CollectionArgument`:

        CollectionArgument(
            path=Path("/full/path/to/pkg/tests/test_foo.py"),
            parts=["TestClass", "test_foo"],
            module_name=None,
        )

    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, which may look like this:

        CollectionArgument(
            path=Path("/home/u/myvenv/lib/site-packages/pkg/tests/test_foo.py"),
            parts=["TestClass", "test_foo"],
            module_name="pkg.tests.test_foo",
        )

    If the path doesn't exist, raise UsageError.
    If the path is a directory and selection parts are present, raise UsageError.
    r  r  éÿÿÿÿNz9module 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})rB   r  r  )
rL   Ú	partitionr  r4  r   r   r   Úformatr®   r6  )r7  r  r  rU   ZsquacketÚrestZstrpathr  r  Zpyarg_strpathrÛ   r^   rQ   rQ   rR   r  ï  s:    #ÿýÿýýr  )VrÅ   Ú
__future__r   rY   Údataclassesr¥   rM   rH   Úimportlib.utilrk   Úpathlibr   rq   Útypingr   r   r   r   r   r	   r
   r   r   r   rð   Zpluggyrx   r   Z_pytest._codeZ_pytest.configr   r   r   r   r   r   Z_pytest.config.argparsingr   Z_pytest.config.compatr   Z_pytest.outcomesr   Z_pytest.pathlibr   r   r   r   r   Z_pytest.reportsr   r    Z_pytest.runnerr!   r"   Z_pytest.warning_typesr#   Útyping_extensionsr$   Z_pytest.fixturesr%   rS   rO   r‚   r‡   r…   rˆ   r‰   r�   r¯   r´   r¹   rº   rw   r‘   ro   ru   Ú	dataclassrL   rÆ   Z	Directoryr±   r  rh   r4  r6  r  rQ   rQ   rQ   rR   Ú<module>   s–    =;&3   8
	ÿ