o
    Zh                  	   @   s  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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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/m0Z0 ddl/m1Z1 dd l/m2Z2 dd!l/m3Z3 dd"l/m4Z4 dd#l5m6Z6 dd$l5m7Z7 dd%l8m9Z9 dd&l8m:Z: dd'l;m<Z< erdd(lm=Z= d)e(d*dfd+d,Z>d-e?d*e?fd.d/Z@d0e!d1ee!d2geeeAe#f  f d*eeAe#f fd3d4ZBd0e!d*eeAe#f fd5d6ZCd0e!d7d2d*eeeAe#f  fd8d9ZDdbd:d;ZEd7d2d*eFfd<d=ZGd-e	d*eFfd>d?ZHd@e	d0e!d*eeF fdAdBZId-e	dCejJd*eejJ fdDdEZKdFeejL d0e!d*dfdGdHZMG dIdJ dJZNG dKdL dLeOZPG dMdN dNeQZRejSG dOdP dPee	e?f ZTeG dQdR dRejUZVeG dSd2 d2ejJZWdTe?d*ee? fdUdVZXejSdWdXG dYdZ dZZYd[d\d]e	d^e?d_eFd*eYfd`daZZdS )czHCore implementation of the testing process: init, session, runtest loop.    N)Path)AbstractSet)Callable)Dict)final)	FrozenSet)Iterable)Iterator)List)Literal)Optional)overload)Sequence)Tuple)TYPE_CHECKING)Union)nodes)Config)directory_arg)ExitCode)hookimpl)PytestPluginManager)
UsageError)Parser)PathAwareHookProxy)FixtureManager)exitabsolutepath)bestrelpath
fnmatch_ex)safe_exists)scandir)CollectReport)
TestReport)collect_one_node)
SetupState)PytestWarning)Self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)d*td+d,d- |jd.d"d/d0d1d2 |jd3dd4d5d6 | d7d8}|jd9d:d;d"d<d |jd=d"d>d |jd?dd@dAdB |jdCdd@dDdB |jdEddFdGdB |jdHdId dJtjtdHdKdLdM |jdNd"dOd/dPdQ |jdRdSd"dTd/dUdQ |jdVd"dWd/dXdQ |jdYdZg d[d\d]d^ | j d_d`d/dadb | dcdd}|jdedfd t	dJdgdh d S )iNnorecursedirsz)Directory patterns to avoid for recursionargs)	z*.eggz.*_darcsbuild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)r8   r;   filterwarningsZlinelistz_Each line specifies a pattern for warnings.filterwarnings. Processed after -W/--pythonwarnings.)r3   r;   z	--maxfailnumstorer   z'Exit after first num failures or errors)metavarr8   r3   r9   r4   r;   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@   r3   r9   r;   z--continue-on-collection-errorsFcontinue_on_collection_errorsz4Force test execution even if collection errors occur)r8   r4   r9   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'.)r8   r9   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))r8   r@   r;   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)r9   r4   r@   r3   r;   z--noconftestZ
noconftestz Don't load any conftest.py files)r8   r9   r4   r;   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)rL   r<   	importlibZ
importmodez\Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.)r4   choicesr9   r;   Zconsider_namespace_packagesboolzEConsider namespace packages when resolving module names during import)r3   r4   r;   Zdebugconfigz(test session debugging and configurationz
--basetempZbasetempz^Base temporary directory for this test run. (Warning: this directory is removed if it exists.))r9   r4   r3   r@   r;   )
ZaddiniZgetgroupZ
_addoptionZ	addoptionintstr	functoolspartialr   validate_basetemp)r*   group rV   C/var/www/html/lang_env/lib/python3.10/site-packages/_pytest/main.pypytest_addoption;   sB  
			
rX   rG   c                 C   sp   d}| s	t |dtdtdtfdd}|t t|  r$t ||t  t|  r6t || 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 v S )z,Return whether query is an ancestor of base.T)parents)rY   rZ   rV   rV   rW   is_ancestor   s   
z&validate_basetemp.<locals>.is_ancestor)argparseArgumentTypeErrorr   rO   cwdabsoluteresolve)rG   msgr\   rV   rV   rW   rT      s   


rT   configdoitSessionc                 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   r7   session   Nz: 
)excinfoz(mainloop: caught unexpected SystemExit!
)rg   
exitstatus))re   from_configr   OKrk   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typenamerb   Zpytest_keyboard_interruptBaseExceptionINTERNAL_ERRORZnotify_exceptionoptionr3   __name__
SystemExitoschdir	startpathZpytest_sessionfinishZ_ensure_unconfigure)rc   rd   rg   Z	initstaterj   rk   excrV   rV   rW   wrap_session  s   


*

*

*
r   c                 C   s
   t | tS N)r   _mainrc   rV   rV   rW   pytest_cmdline_mainK  s   
r   rg   c                 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.rf   r   N)rn   pytest_collectionpytest_runtestlooptestsfailedr   rp   testscollectedZNO_TESTS_COLLECTED)rc   rg   rV   rV   rW   r   O  s   
r   c                 C   s   |    d S r   )perform_collectrf   rV   rV   rW   r   \  s   r   c                 C   s   | j r| jjjs| d| j | j dkrdf df | jjjr#dS t| jD ]1\}}|d t| jk r<| j|d  nd }|jj	j
||d | jrP| | j| jrY| | jq(dS )Nz%d error%s during collectionr7   s T)itemnextitem)r   rc   r~   rC   InterruptedZcollectonly	enumerateitemslenrn   Zpytest_runtest_protocol
shouldfailro   
shouldstop)rg   ir   r   rV   rV   rW   r   `  s(   
$r   c                    s`   |  tjdr
dnd}z	| sW dS W n
 ty    Y dS w d t fdd| D S )zAttempt to detect if ``path`` is the root of a Virtual Environment by
    checking for the existence of the appropriate activate script.winScriptsbinF)activatezactivate.cshzactivate.fishZActivatezActivate.batzActivate.ps1c                 3   s    | ]}|j  v V  qd S r   name).0fnameZ	activatesrV   rW   	<genexpr>      z_in_venv.<locals>.<genexpr>)joinpathrx   platform
startswithis_dirOSErroranyiterdir)rG   ZbindirrV   r   rW   _in_venvt  s   r   collection_pathc                    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__TZcollect_ignorerG   ignorec                 s       | ]}t |V  qd S r   r   r   xrV   rV   rW   r         z(pytest_ignore_collect.<locals>.<genexpr>Zcollect_ignore_globZignore_globc                 s   r   r   r   r   rV   rV   rW   r     r   c                 3   s$    | ]}t  t t|V  qd S r   )fnmatchrQ   )r   globr   rV   rW   r     s   " rK   r,   c                 3   s    | ]}t | V  qd S r   r    )r   patr   rV   rW   r     r   )	r   Z_getconftest_pathlistparent	getoptionextendr   r   r   Zgetini)r   rc   Zignore_pathsZ
excludeoptZignore_globsZexcludegloboptZallow_in_venvZnorecursepatternsrV   r   rW   pytest_ignore_collect  s8   




r   r   c                 C   s   t j|| dS )Nr   )Dirfrom_parentrG   r   rV   rV   rW   pytest_collect_directory  s   r   r   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 )NZdeselect)r   )tupler   nodeidr   r<   rn   Zpytest_deselected)r   rc   Zdeselect_prefixes	remainingZ
deselectedZcolitemrV   rV   rW   pytest_collection_modifyitems  s   r   c                   @   s:   e Zd Zdedee ddfddZdedej	fdd	Z
dS )
FSHookProxypmremove_modsr+   Nc                 C   s   || _ || _d S r   )r   r   )selfr   r   rV   rV   rW   __init__  s   
zFSHookProxy.__init__r   c                 C   s    | j j|| jd}|| j|< |S )N)Zremove_plugins)r   Zsubset_hook_callerr   __dict__)r   r   r   rV   rV   rW   __getattr__  s   
zFSHookProxy.__getattr__)r   
__module____qualname__r   r   objectr   rQ   pluggyZ
HookCallerr   rV   rV   rV   rW   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__rV   rV   rV   rW   r     s    r   c                   @   s   e Zd ZdZdS )ro   z"Signals a stop as failed test run.Nr   rV   rV   rV   rW   ro     s    ro   c                   @   s,   e Zd ZU dZeed< dedefddZdS )_bestrelpath_cacher   rG   r+   c                 C   s   t | j|}|| |< |S r   )r   rG   )r   rG   rrV   rV   rW   __missing__  s   z_bestrelpath_cache.__missing__N)r   r   r   	__slots__r   __annotations__rQ   r   rV   rV   rV   rW   r     s   
 r   c                       sR   e Zd ZdZedejdeddf fddZde	e
ejejf  f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   rG   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.
        )r   rG   )superr   )clsr   rG   	__class__rV   rW   r     s   zDir.from_parentc                 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   rc   r   	file_pathr   )rc   ihookr#   rG   r   r   rg   
isinitpathr   r   is_filepytest_collect_file)r   rc   r   ZdirentryrG   colcolsrV   rV   rW   rE     s,   


zDir.collect)r   r   r   r   classmethodr   	Collectorr   r   r   r   ItemrE   __classcell__rV   rV   r   rW   r     s    &r   c                       s  e Zd ZU dZeZeZeed< eed< e	e
ef ed< deddf fdd	Zededd fd
dZdefddZede	eef fddZejde	eef ddfddZede	eef fddZejde	eef ddfddZedefddZdedefddZeddd>ddZeddde	eef ddfdd ZeZd!d"d#e	ed$f d%edefd&d'Z d(d$de!j"fd)d*Z#d#ed+e$ee%e&j' f de%e&j' fd,d-Z(e)	.d?d/e*e%e  d0d1de%e&j+ fd2d3Z,e)	.d?d/e*e%e  d0ede%e	e&j+e&j'f  fd4d3Z,	d@d/e*e%e  d0ede%e	e&j+e&j'f  fd5d3Z,	dAd6e&j'd7ede-eef fd8d9Z.de/e	e&j+e&j'f  fd:d;Z0d6e	e&j+e&j'f de/e&j+ fd<d=Z1  Z2S )Bre   zoThe root of the collection tree.

    ``Session`` collects the initial paths given as arguments to pytest.
    Z_setupstateZ_fixturemanagerrk   rc   r+   Nc              	      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   rG   fspathr   rc   rg   r   r   FrF   rg   r   )r   r   Zrootpathr   r   _shouldstop_shouldfailtracerootget	frozenset_initialpaths_initialpaths_with_parents	_notfound_initial_parts_collection_cacher   r   _bestrelpathcacherc   pluginmanagerregister)r   rc   r   rV   rW   r   -  s,   	zSession.__init__c                 C   s   | j |d}|S )Nr   )_create)r   rc   rg   rV   rV   rW   rl   G  s   zSession.from_configc                 C   s$   d| j j| jt| dd| j| jf S )Nz6<%s %s exitstatus=%r testsfailed=%d testscollected=%d>rk   z<UNSET>)r   r   r   getattrr   r   r   rV   rV   rW   __repr__L  s   
zSession.__repr__c                 C      | j S r   )r   r   rV   rV   rW   r   U     zSession.shouldstoprv   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.rh   
stacklevel)r   warningswarnr(   r   rv   rV   rV   rW   r   Y     
c                 C   r   r   )r   r   rV   rV   rW   r   g  r   zSession.shouldfailc                 C   r   )NFzCsession.shouldfail cannot be unset after it has been set; ignoring.rh   r   )r   r  r  r(   r  rV   rV   rW   r   k  r  c                 C   s
   | j jjS )zQThe path from which pytest was invoked.

        .. versionadded:: 7.0.0
        )rc   invocation_paramsrH   r   rV   rV   rW   r   y  s   
zSession.startpath	node_pathc                 C   s
   | j | S r   )r   )r   r  rV   rV   rW   _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   ro   r   r   r   rV   rV   rW   pytest_collectstart  s
   zSession.pytest_collectstartreportc                 C   sX   |j r$t|ds&|  jd7  _| jd}|r(| j|kr*d| j | _d S d S d S d S d S )NZwasxfailr7   r6   zstopping after %d failures)Zfailedhasattrr   rc   getvaluer   )r   r
  r6   rV   rV   rW   pytest_runtest_logreport  s   z Session.pytest_runtest_logreportFr   rG   zos.PathLike[str]r   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.
        )ru   r   r   r   )r   rG   r   Zpath_rV   rV   rW   r     s   

zSession.isinitpathr   c                 C   sV   t |tr|nt|}| jj}||}|j|}|r%tt||}|S | jj	}|S r   )
ru   r   rc   r   Z_getconftestmodulesZ_conftest_plugins
differencer   r   rn   )r   r   rG   r   Zmy_conftestmodulesr   proxyrV   rV   rW   gethookproxy  s   
zSession.gethookproxy
path_cachec                 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   NrV   r   )r   r  r   r   r   r   )r   rG   r  r   r   r   rV   rV   rW   _collect_path  s   

zSession._collect_path.r-   genitemszLiteral[True]c                 C      d S r   rV   r   r-   r  rV   rV   rW   r        zSession.perform_collectc                 C   r  r   rV   r  rV   rV   rW   r     r  c              	   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   r7   	as_pypathr
  znot found: z
(no match in any of )zfound no collectors for )rg   rc   r   rf   )#rc   r-   r   r   indentrn   r   r   r   r   resolve_collection_argumentr  rH   r~   Zpyargsr<   rG   r   r[   r   r   r   r&   r   pytest_collectreportr   resultpassedr  r   Zcheck_pendingr   Zpytest_collection_finishr   r   )r   r-   r  rn   r   ZinitialpathsZinitialpaths_with_parentsargcollection_argumentreperrorsZ
collectorsnoderV   rV   rW   r     sr   



r$  handle_dupesc                 C   s:   || j v r|r| j | }|dfS t|}|| j |< |dfS )NTF)r   r&   )r   r$  r%  r"  rV   rV   rW   _collect_one_node>  s   

zSession._collect_one_nodec                 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 argumentr7   zinvalid arg r   .rh   FTr  win32[::))rc   r   r   r   r   r  rG   partsmodule_namer   r[   Z_is_in_confcutdirinsertsplitr   r   stempopru   r   r   re   r   r  r   r&  r  r   r  r  reversedrx   r   r   samefileislinkr   r<   joinrQ   r   )r   r  r   r!  Zargpathnamesr,  pathsrG   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_argrV   rV   rW   rE   K  s   







FzSession.collectc                 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 )Nr  )r   rJ   r  )r   ru   r   r   r   Zpytest_itemcollectedr   rc   r   Filer&  r  r  r  r  )r   r$  rJ   r%  r"  r7  ZsubnoderV   rV   rW   r    s"   

zSession.genitems)r+   N)..)NT)T)3r   r   r   r   r   ro   r'   r   r   r   rP   r   r   r   r   rl   rQ   r   propertyrO   r   setterr   r   r   r  r   r	  r%   r$   r  r  r   r   Z	HookRelayr  r   r   r   r   r  r   r   r   r   r   r&  r	   rE   r  r   rV   rV   r   rW   re     s   
 	
	






U

yr,  c              
   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)rM   util	find_specAttributeErrorImportError
ValueErrororiginsubmodule_search_locationsr   rG   dirname)r,  specrV   rV   rW   search_pypath  s   rE  T)frozenc                   @   s2   e Zd ZU dZeed< ee ed< ee ed< dS )CollectionArgumentzA resolved collection argument.rG   r+  r,  N)	r   r   r   r   r   r   r   rQ   r   rV   rV   rV   rW   rG    s
   
 rG  Fr  invocation_pathr   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.
    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})rG   r+  r,  )
rQ   	partitionr.  rE  r   r"   r   formatr   rG  )rH  r   r  rY   ZsquacketrestZstrpathr+  r,  Zpyarg_strpathr   rb   rV   rV   rW   r    s:   #r  )rg   re   r+   N)[r   r]   dataclassesr   rR   rM   importlib.utilr   pathlibr   rx   typingr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r  r   rs   r   Z_pytest._codeZ_pytest.configr   r   r   r   r   r   Z_pytest.config.argparsingr   Z_pytest.config.compatr   Z_pytest.fixturesr   Z_pytest.outcomesr   Z_pytest.pathlibr   r   r!   r"   r#   Z_pytest.reportsr$   r%   Z_pytest.runnerr&   r'   Z_pytest.warning_typesr(   r)   rX   rQ   rT   rP   r   r   r   r   rO   r   r   r   r   r   r   r   r   rq   r   rr   ro   	dataclassr   Z	Directoryr   re   rE  rG  r  rV   rV   rV   rW   <module>   s     =

;"
&
2   >
	