o
    h9                     @  s
  d 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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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+m0Z0 ddl1m2Z2 ddl1m3Z3 ddl4m5Z5 dd l4m6Z6 dd!l7m8Z8 erdd"l9m:Z: dd#l;m<Z< dkd(d)Z=dld,d-Z>dmd3d4Z?dnd5d6Z@dod:d;ZAdpd<d=ZBdqd?d@ZCdrdBdCZDdsdFdGZEdtdKdLZFdudOdPZGG dQdR dRZHG dSdT dTeIZJG dUdV dVeKZLejMG dWdX dXeNeeOf ZPeG dYdZ dZejQZReG d[d8 d8ejSZTdvd^d_ZUejMd`daG dbdc dcZVdddedwdidjZWdS )xzHCore implementation of the testing process: init, session, runtest loop.    )annotationsN)Callable)Iterable)Iterator)Sequence)Set)Path)final)Literal)overload)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)FixtureManagerparserr   returnNonec              	   C  s   |  dd}|jddd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 |  d}|jddddd | jdddd  |  d!d"}|jd#d$d%dd&d |jd'dd(d |jd)dd*d+d, |jd-dd*d.d, |jd/dd0d1d, |jd2d3d d4tjtd2d5d6d7 |jd8dd9d:d;d< |jd=d>dd?d:d@d< |jdAddBd:dCd< |jdDdd:dEdFdG |jdHdIg dJdKdLdM | jdNdOdPg dQdR | jdSdTdPg dR | jdUdVdWdXdR | jdYdWd:dZd[ |  d\d]}|jd^d_d`tdadbdc |jddddedfdg |jdhdid t	d4djdk d S )lNgeneralzRunning and selection optionsz-xz--exitfirststore_constmaxfail   z,Exit instantly on first error or failed test)actiondestconsthelpz	--maxfailnumstorer   z'Exit after first num failures or errors)metavarr,   typer-   defaultr/   z--strict-config
store_truezbAny warnings encountered while parsing the `pytest` section of the configuration file raise errors)r,   r/   z--strict-markerszVMarkers not registered in the `markers` section of the configuration file raise errorsz--strictz&(Deprecated) alias to --strict-markerszpytest-warningsz-Wz--pythonwarningsappendz<Set which warnings to report, see -W option of Python itselffilterwarningslinelistz_Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings.)r3   r/   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))r,   r2   r/   z--ignore-globz5Ignore path pattern during collection (multi-allowed)z
--deselectnodeid_prefixzDDeselect item (via node id prefix) during collection (multi-allowed)z--confcutdir
confcutdirdir)optnamez1Only load conftest.py's relative to specified dir)r-   r4   r2   r3   r/   z--noconftest
noconftestFz Don't load any conftest.py files)r,   r-   r4   r/   z--keepduplicatesz--keep-duplicateskeepduplicateszKeep duplicate testsz--collect-in-virtualenvcollect_in_virtualenvz2Don't ignore tests in a local virtualenv directoryz--continue-on-collection-errorscontinue_on_collection_errorsz4Force test execution even if collection errors occur)r,   r4   r-   r/   z--import-modeprepend)rD   r6   	importlib
importmodez\Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.)r4   choicesr-   r/   norecursedirsz)Directory patterns to avoid for recursionargs)	z*.eggz.*_darcsbuildCVSdistnode_modulesvenvz{arch})r3   r4   	testpathszZDirectories to search for tests when no files or directories are given on the command linecollect_imported_testsz@Whether to collect tests in imported modules outside `testpaths`boolTconsider_namespace_packageszEConsider namespace packages when resolving module names during import)r3   r4   r/   debugconfigz(test session debugging and configurationz-cz--config-fileFILEinifilenamezcLoad configuration from `FILE` instead of trying to locate one of the implicit configuration files.)r2   r3   r-   r/   z	--rootdirrootdirzDefine 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'.)r,   r-   r/   z
--basetempbasetempz^Base temporary directory for this test run. (Warning: this directory is removed if it exists.))r-   r4   r3   r2   r/   )
getgroup
_addoption	addoptionintaddini	functoolspartialr   strvalidate_basetemp)r%   group rc   M/var/www/html/openai_agents/venv/lib/python3.10/site-packages/_pytest/main.pypytest_addoption8   sN  	
	
re   r;   r`   c                 C  sd   d}| s	t |d	dd}|t t|  rt ||t  t|  r0t || S )
NzWbasetemp must not be empty, the current working directory or any parent directory of itbaser   queryr&   rR   c                 S  s   | |krdS || j v S )z,Return whether query is an ancestor of base.T)parents)rf   rg   rc   rc   rd   is_ancestor  s   
z&validate_basetemp.<locals>.is_ancestor)rf   r   rg   r   r&   rR   )argparseArgumentTypeErrorr   cwdabsoluteresolve)r;   msgri   rc   rc   rd   ra      s   



ra   configr   doit2Callable[[Config, Session], int | ExitCode | None]int | ExitCodec                 C  s  t | }tj|_d}zz|   d}| jj|d d}|| |p#d|_W n ty2   tj	|_  t
y>   tj|_Y n ttjfy   tjj }tj}t|jtjrt|jjdura|jj}|dk rttj|j d|jj d | jj|d ||_Y nT ty   tj|_tjj }z	| || j  W n+ tjy } z|jdur|j|_tjt!|j" d| d W Y d}~nd}~ww t|jt#rtjd	 Y nw W d}t$%|j& |dkrz| jj'||jd
 W n- tjy } z|jdur|j|_tjt!|j" d| d W Y d}~nd}~ww | (  |jS d}t$%|j& |dkrhz| jj'||jd
 W n- tjyg } z|jdurN|j|_tjt!|j" d| d W Y d}~nd}~ww | (  w )zSkeleton command line program.r   r+   session   Nz: 
)excinfoz(mainloop: caught unexpected SystemExit!
)ru   
exitstatus))Sessionfrom_configr   OKry   _do_configurehookpytest_sessionstartr   USAGE_ERRORFailedTESTS_FAILEDKeyboardInterruptr   	Exception_pytest_codeExceptionInfofrom_currentINTERRUPTED
isinstancevalue
returncodesysstderrwritetypenamero   pytest_keyboard_interruptBaseExceptionINTERNAL_ERRORnotify_exceptionoptionr3   __name__
SystemExitoschdir	startpathpytest_sessionfinish_ensure_unconfigure)rp   rq   ru   	initstaterx   ry   excrc   rc   rd   wrap_session  s   


*

*

*
r   c                 C  s
   t | tS N)r   _mainrp   rc   rc   rd   pytest_cmdline_mainO  s   
r   ru   rz   int | ExitCode | Nonec                 C  s<   | j j|d | j j|d |jrtjS |jdkrtjS dS )z[Default command line protocol for initialization, session,
    running tests and reporting.rt   r   N)r~   pytest_collectionpytest_runtestlooptestsfailedr   r   testscollectedNO_TESTS_COLLECTED)rp   ru   rc   rc   rd   r   S  s   
r   c                 C  s   |    d S r   )perform_collectrt   rc   rc   rd   r   `  s   r   rR   c                 C  s   | j r| jjjs| | j  d| j dkrdnd d| jjjr"dS t| jD ]1\}}|d t| jk r;| j|d  nd }|jj	j
||d | jrO| | j| jrX| | jq'dS )Nz errorr+   s z during collectionT)itemnextitem)r   rp   r   rC   Interruptedcollectonly	enumerateitemslenr~   pytest_runtest_protocol
shouldfailr   
shouldstop)ru   ir   r   rc   rc   rd   r   d  s   
$r   r   c                 C  s6   z|  d p|  dd W S  ty   Y dS w )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historyF)joinpathis_fileOSErrorr;   rc   rc   rd   _in_venvw  s   r   collection_pathbool | Nonec                   s    j dkrdS |jd jd}|pg }|d}|r$|dd |D   |v r*dS |jd jd}|p5g }|d	}|rG|d
d |D  t fdd|D rTdS |d}|sat radS   rw|d}t fdd|D rwdS d S )N__pycache__Tcollect_ignorer   ignorec                 s      | ]}t |V  qd S r   r   .0xrc   rc   rd   	<genexpr>      z(pytest_ignore_collect.<locals>.<genexpr>collect_ignore_globignore_globc                 s  r   r   r   r   rc   rc   rd   r     r   c                 3  s$    | ]}t  t t|V  qd S r   )fnmatchr`   )r   globr   rc   rd   r     s   " rB   rH   c                 3  s    | ]}t | V  qd S r   r   )r   patr   rc   rd   r     s    )	name_getconftest_pathlistparent	getoptionextendanyr   is_dirgetini)r   rp   ignore_paths
excludeoptignore_globsexcludegloboptallow_in_venvnorecursepatternsrc   r   rd   pytest_ignore_collect  s8   




r   r   nodes.Collectornodes.Collector | Nonec                 C  s   t j|| dS )Nr   )Dirfrom_parentr;   r   rc   rc   rd   pytest_collect_directory  s   r   r   list[nodes.Item]c                 C  st   t |dpg }|sd S g }g }| D ]}|j|r!|| q|| q|r8|jj|d || d d < d S d S )Ndeselect)r   )tupler   nodeid
startswithr6   r~   pytest_deselected)r   rp   deselect_prefixes	remaining
deselectedcolitemrc   rc   rd   pytest_collection_modifyitems  s   r   c                   @  s    e Zd ZdddZdddZdS )FSHookProxypmr   remove_modsAbstractSet[object]r&   r'   c                 C  s   || _ || _d S r   )r   r   )selfr   r   rc   rc   rd   __init__  s   
zFSHookProxy.__init__r   r`   pluggy.HookCallerc                 C  s    | j j|| jd}|| j|< |S )N)remove_plugins)r   subset_hook_callerr   __dict__)r   r   r   rc   rc   rd   __getattr__  s   
zFSHookProxy.__getattr__N)r   r   r   r   r&   r'   )r   r`   r&   r   )r   
__module____qualname__r   r   rc   rc   rc   rd   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__rc   rc   rc   rd   r     s    r   c                   @  s   e Zd ZdZdS )r   z"Signals a stop as failed test run.Nr   rc   rc   rc   rd   r     s    r   c                   @  s$   e Zd ZU dZded< d	ddZdS )
_bestrelpath_cacher   r   r;   r&   r`   c                 C  s   t | j|}|| |< |S r   )r   r;   )r   r;   rrc   rc   rd   __missing__  s   z_bestrelpath_cache.__missing__N)r;   r   r&   r`   )r   r   r   	__slots____annotations__r  rc   rc   rc   rd   r     s   
 r   c                      s0   e Zd ZdZed fdd	Z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   r&   r#   c                  s   t  j||dS )zThe public constructor.

        :param parent: The parent collector of this Dir.
        :param path: The directory's path.
        :type path: pathlib.Path
        )r   r;   )superr   )clsr   r;   	__class__rc   rd   r     s   zDir.from_parent&Iterable[nodes.Item | nodes.Collector]c                 c  s    | j }| j}t| jD ]M}| r6t|j}| jj|dds'|j||dr'q|j	|| d}|d ur5|V  q|
 rYt|j}| j|sM|j||drMq|j|| d}|E d H  qd S )NTwith_parents)r   rp   r   	file_pathr   )rp   ihookr   r;   r   r   ru   
isinitpathr   r   r   pytest_collect_file)r   rp   r  direntryr;   colcolsrc   rc   rd   r9     s,   


zDir.collect)r   r   r;   r   r&   r#   )r&   r  )r   r   r   r   classmethodr   r9   __classcell__rc   rc   r  rd   r     s
    r   c                      sT  e Zd ZU dZeZeZded< ded< ded< dT fddZedUddZ	dVddZ
edWddZejdXddZedWddZejdXddZedYddZdZdd Zed!d"d[d#d$Zed!d"d\d'd(ZeZd)d*d]d/d0Zd^d4d5Zd_d9d:Ze	;d`dadAdBZe	;d`dbdDdBZ	!dcdbdFdBZ	!dddedKdLZdfdNdOZdgdRdSZ  ZS )hrz   zoThe root of the collection tree.

    ``Session`` collects the initial paths given as arguments to pytest.
    r!   _setupstater$   _fixturemanagerrs   ry   rp   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   r;   fspathr   rp   ru   r   r   Fr:   ru   )r   )r  r   rootpathr   r   _shouldstop_shouldfailtracerootget	frozenset_initialpaths_initialpaths_with_parents	_notfound_initial_parts_collection_cacher   r   _bestrelpathcacherp   pluginmanagerregister)r   rp   r  rc   rd   r   2  s,   	zSession.__init__c                 C  s   | j |d}|S )Nr   )_create)r  rp   ru   rc   rc   rd   r{   L  s   zSession.from_configr`   c              	   C  s4   d| j j d| j d| j d| j d	t| dd S )N< z exitstatus=%r testsfailed=z testscollected=>ry   z<UNSET>)r  r   r   r   r   getattrr   rc   rc   rd   __repr__Q  s   
zSession.__repr__
bool | strc                 C     | j S r   )r  r,  rc   rc   rd   r   Y     zSession.shouldstopr   c                 C  .   |du r| j rtjtddd d S || _ d S )NFzCsession.shouldstop cannot be unset after it has been set; ignoring.rv   
stacklevel)r  warningswarnr"   r   r   rc   rc   rd   r   ]     
c                 C  r/  r   )r  r,  rc   rc   rd   r   k  r0  zSession.shouldfailc                 C  r1  )NFzCsession.shouldfail cannot be unset after it has been set; ignoring.rv   r2  )r  r4  r5  r"   r6  rc   rc   rd   r   o  r7  r   c                 C  s
   | j jjS )zQThe path from which pytest was invoked.

        .. versionadded:: 7.0.0
        )rp   invocation_paramsr>   r,  rc   rc   rd   r   }  s   
zSession.startpath	node_pathc                 C  s
   | j | S r   )r$  )r   r9  rc   rc   rd   _node_location_to_relpath  s   
z!Session._node_location_to_relpathT)tryfirstc                 C  s(   | j r	| | j | jr| | jd S r   )r   r   r   r   r,  rc   rc   rd   pytest_collectstart  s
   zSession.pytest_collectstartreportTestReport | CollectReportc                 C  s\   |j r&t|ds(|  jd7  _| jd}|r*| j|kr,d| j d| _d S d S d S d S d S )Nwasxfailr+   r*   zstopping after z	 failures)failedhasattrr   rp   getvaluer   )r   r=  r*   rc   rc   rd   pytest_runtest_logreport  s   z Session.pytest_runtest_logreportFr	  r;   str | os.PathLike[str]r
  rR   c                C  s.   t |tr|nt|}|r|| jv S || jv 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.
        )r   r   r   r  )r   r;   r
  path_rc   rc   rd   r    s   

zSession.isinitpathr  os.PathLike[str]pluggy.HookRelayc                 C  sV   t |tr|nt|}| jj}||}|j|}|r%tt||}|S | jj	}|S r   )
r   r   rp   r%  _getconftestmodules_conftest_plugins
differencer   r   r~   )r   r  r;   r   my_conftestmodulesr   proxyrc   rc   rd   gethookproxy  s   
zSession.gethookproxy
path_cache%dict[Path, Sequence[nodes.Collector]]Sequence[nodes.Collector]c                 C  sx   ||v r|| S |  r#| |j}|j|| d}|dur |fnd}n| r4| |}|j|| d}nd}|||< |S )zCreate a Collector for the given path.

        `path_cache` makes it so the same Collectors are returned for the same
        path.
        r   Nrc   r  )r   rM  r   r   r   r  )r   r;   rN  r  r  r  rc   rc   rd   _collect_path  s   

zSession._collect_path.rI   Sequence[str] | NonegenitemsLiteral[True]Sequence[nodes.Item]c                 C     d S r   rc   r   rI   rS  rc   rc   rd   r        zSession.perform_collect&Sequence[nodes.Item | nodes.Collector]c                 C  rV  r   rc   rW  rc   rc   rd   r     rX  Nc              	   C  s  |du r| j j}| d| | | jj jd7  _| j j}g | _g | _i | _g | _	| j	}zg }g }|D ](}t
| j jj|| j jjd}| j| ||j ||j ||jj q2t|| _t|| _t| }	| jj|	d | jj jd8  _| jrg }
| jD ]\}}|r|
d| d|d q|
d	|  qt|
 |s|	j}n|	jr|	jD ]}| j	| | q| j j  |j| | j |d
 W g | _g | _i | _|j | d ng | _g | _i | _|j | d w |rt!|| _"|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   r+   	as_pypathr=  znot found: z
(no match in any of )zfound no collectors for )ru   rp   r   rt   )#rp   rI   r  r  indentr~   r!  r"  r#  r   resolve_collection_argumentr8  r>   r   pyargsr6   r;   r   rh   r  r  r   r    r  pytest_collectreportr   resultpassedrS  r%  check_pendingr   pytest_collection_finishr   r   )r   rI   rS  r~   r   initialpathsinitialpaths_with_parentsargcollection_argumentreperrors
collectorsnoderc   rc   rd   r     sr   



rm  r   handle_dupestuple[CollectReport, bool]c                 C  s:   || j v r|r| j | }|dfS t|}|| j |< |dfS )NTF)r#  r    )r   rm  rn  rj  rc   rc   rd   _collect_one_node>  s   

zSession._collect_one_node&Iterator[nodes.Item | nodes.Collector]c                 c  s   i }| j j}| jD ]`}| d| | jj jd7  _|j}|j}|j}|	 r4|r4J d||f|g}|d u rO|j
D ]}||sG n|d| q>n&|d}	t|j
dD ]\}
}|
t|	ksl|j|	|
  krn n|d| qZd}g }| g ||fg}|rL| \}}|s|V  d}qt|tjsqt|trt|d tsJ ||d |}n/t|dkot|d to|d   }| ||\}}|s|js|jj|d	 |jsq|j}d}t|D ][}t|d tr|j|d k}tj d
kr|st!j"|j|d }|ot!j#|jt!j#|d k}n|j$|d kp0|j$dd |d k}|rA|%||dd  f d}q|sJ|%| |s|sbd&t'|g|R }| j(%||f | jj jd8  _q
d S )Nzprocessing argumentr+   zinvalid arg r   .rv   FTr\  win32[::))rp   r%  r"  r  r  r^  r;   partsmodule_namer   rh   _is_in_confcutdirinsertsplitr   r   stempopr   r   	Collectorrz   r   rQ  r   rp  rc  r  ra  rb  reversedr   platformr   samefileislinkr   r6   joinr`   r!  )r   rN  r   ri  argpathnamesrw  pathsr;   module_name_partsr   any_matched_in_initial_partnotfound_collectorswork	matchnode
matchpartssubnodesrn  rj  	duplicateany_matched_in_collectorrm  is_match	same_file
report_argrc   rc   rd   r9   K  s   







FzSession.collectnodes.Item | nodes.CollectorIterator[nodes.Item]c                 c  s    |  d| t|tjr|jj|d |V  d S t|tjs!J | jd}|o.t|tj	 }| 
||\}}|r>|s>d S |jrO|jD ]
}| |E d H  qD|sZ|jj|d d S d S )NrS  )r   rA   r\  )r  r   r   Itemr  pytest_itemcollectedr}  rp   r   Filerp  rc  rb  rS  ra  )r   rm  rA   rn  rj  r  subnoderc   rc   rd   rS    s"   

zSession.genitems)rp   r   r&   r'   )rp   r   r&   rz   )r&   r`   )r&   r.  )r   r.  r&   r'   )r&   r   )r9  r   r&   r`   )r&   r'   )r=  r>  r&   r'   )r;   rD  r
  rR   r&   rR   )r  rF  r&   rG  )r;   r   rN  rO  r&   rP  )..)rI   rR  rS  rT  r&   rU  )rI   rR  rS  rR   r&   rY  )NT)T)rm  r   rn  rR   r&   ro  )r&   rq  )rm  r  r&   r  )r   r   r   r   r   r   r  r   r  r{   r-  propertyr   setterr   r   r:  r   r<  rC  ra  r  rM  rQ  r   r   rp  r9   rS  r  rc   rc   r  rd   rz   #  sV   
 



U
yrw  
str | Nonec              
   C  sf   zt j| }W n tttfy   Y dS w |du s$|jdu s$|jdkr&dS |jr0tj	
|jS |jS )zaSearch sys.path for the given a dotted module name, and return its file
    system path if found.N	namespace)rE   util	find_specAttributeErrorImportError
ValueErrororiginsubmodule_search_locationsr   r;   dirname)rw  specrc   rc   rd   search_pypath  s   r  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   r;   zSequence[str]rv  r  rw  N)r   r   r   r   r  rc   rc   rc   rd   r    s
   
 r  FrZ  invocation_pathrh  r[  c                C  s   t |d\}}}|d^}}|r|d  | | |d< d}|r/t|}	|	dur/|}|	}| | }
t|
}
t|
sI|r?dnd}t|j|d|r]|
 r]|rSd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.
    rt  ru  Nz9module or package not found: {arg} (missing __init__.py?)z"file or directory not found: {arg})rh  z9package argument cannot contain :: selection parts: {arg}z;directory argument cannot contain :: selection parts: {arg})r;   rv  rw  )
r`   	partitionrz  r  r   r   r   formatr   r  )r  rh  r[  rf   squacketreststrpathrv  rw  pyarg_strpathr  ro   rc   rc   rd   r_    s:   #r_  )r%   r   r&   r'   )r;   r`   r&   r`   )rp   r   rq   rr   r&   rs   )rp   r   r&   rs   )rp   r   ru   rz   r&   r   )ru   rz   r&   r'   )ru   rz   r&   rR   )r;   r   r&   rR   )r   r   rp   r   r&   r   )r;   r   r   r   r&   r   )r   r   rp   r   r&   r'   )rw  r`   r&   r  )r  r   rh  r`   r[  rR   r&   r  )Xr   
__future__r   rj   collections.abcr   r   r   r   r   AbstractSetdataclassesr   r^   rE   importlib.utilr   pathlibr   r   typingr	   r
   r   r   r4  pluggyr   r   _pytest._code_pytest.configr   r   r   r   r   r   _pytest.config.argparsingr   _pytest.config.compatr   _pytest.outcomesr   _pytest.pathlibr   r   r   r   r   _pytest.reportsr   r   _pytest.runnerr    r!   _pytest.warning_typesr"   typing_extensionsr#   _pytest.fixturesr$   re   ra   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	dataclassdictr`   r   	Directoryr   r}  rz   r  r  r_  rc   rc   rc   rd   <module>   s    
 
D

;





&
3   
7
	