
    Bh9                       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rdd"l9m:Z: dd#l;m<Z< dCd$Z=dDd%Z>	 	 	 	 	 	 dEd&Z?dFd'Z@dGd)ZAdHd*ZBdId+ZCdJd,ZDdKd-ZE	 	 	 	 	 	 dLd.ZFdMd/ZG G d0 d1      ZH G d2 d3eI      ZJ G d4 d5eK      ZLej                   G d6 d7eNeeOf                ZPe G d8 d9ej                               ZRe G d: d(ej                               ZTdNd;ZU ej                  d<=       G d> d?             ZVd@dA	 	 	 	 	 	 	 dOdBZWy)PzHCore 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)FixtureManagerc           
        | j                  dd      }|j                  dddddd	       |j                  d
ddt        ddd       |j                  ddd       |j                  ddd       |j                  ddd       | j                  d      }|j                  dddd       | j	                  ddd        | j                  d!d"      }|j                  d#d$d%dd&       |j                  d'dd(       |j                  d)dd*d+,       |j                  d-dd*d.,       |j                  d/dd0d1,       |j                  d2d3d d4t        j                  t        d25      d67       |j                  d8dd9d:d;<       |j                  d=d>dd?d:d@<       |j                  dAddBd:dC<       |j                  dDdd:dEdFG       |j                  dHdIg dJdKdLM       | j	                  dNdOdPg dQR       | j	                  dSdTdPg R       | j	                  dUdVdWdXR       | j	                  dYdWd:dZ[       | j                  d\d]      }|j                  d^d_d`t        dadbc       |j                  ddddedfg       |j                  dhdid t        d4djk       y )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.)r2   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+   r1   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,   r3   r1   r2   r.   z--noconftest
noconftestFz Don't load any conftest.py files)r+   r,   r3   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+   r3   r,   r.   z--import-modeprepend)rC   r5   	importlib
importmodez\Prepend/append to sys.path when importing test modules and conftest files. Default: prepend.)r3   choicesr,   r.   norecursedirsz)Directory patterns to avoid for recursionargs)	z*.eggz.*_darcsbuildCVSdistnode_modulesvenvz{arch})r2   r3   	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)r2   r3   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.)r1   r2   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,   r3   r2   r1   r.   )
getgroup
_addoption	addoptionintaddini	functoolspartialr   strvalidate_basetemp)parsergroups     W/var/www/html/Telegram-Engagement-Pod-/env/lib/python3.12/site-packages/_pytest/main.pypytest_addoptionrd   8   s   OOI'FGE	;   
OO6   
OO*   
OO   
OO5   OO-.E	OOK	   MM/   OOI|4E	OO5   
OO@  
 
OO<	   
OOD	   
OOS	   
OO}nE@   
OO/   
OO#   
OO!$A   
OO),C   
OO2#   MM3

	    MM	   MM J	   MM%T	   OOM+UVE	(   
OO	   
OOA  
    c                x   d}| st        j                  |      dd} |t        j                         t        |       j	                               rt        j                  |       |t        j                         j                         t        |       j                               rt        j                  |      | S )NzWbasetemp must not be empty, the current working directory or any parent directory of itc                *    | |k(  ry|| j                   v S )z,Return whether query is an ancestor of base.T)parents)basequerys     rc   is_ancestorz&validate_basetemp.<locals>.is_ancestor  s    5=$$re   )ri   r	   rj   r	   returnrQ   )argparseArgumentTypeErrorr	   cwdabsoluteresolve)r:   msgrk   s      rc   r`   r`      s    
cC ((--% 488:tDz2245((-- 488:%%'d););)=>((--Kre   c           	     	   t         j                  |       }t        j                  |_        d}	 	 | j                          d}| j                  j                  |       d} || |      xs d|_        d}tI        jJ                  |jL                         |dk\  r(	 | j                  jO                  ||j                  
       | jQ                          |j                  S # t        $ r t        j                  |_         t        $ r t        j                  |_        Y t        t        j                  f$ r t        j                   j"                  j%                         }t        j&                  }t)        |j*                  t        j                        rt|j*                  j,                  |j*                  j,                  }|dk  rCt.        j0                  j3                  |j4                   d|j*                  j6                   d       | j                  j9                  |       ||_        Y t:        $ r t        j<                  |_        t        j                   j"                  j%                         }	 | j?                  || j@                         t)        |j*                  tB              rt.        j0                  j3                  d	       nu# t        j                  $ r_}|j,                  |j,                  |_        t.        j0                  j3                  tE        |      jF                   d| d       Y d}~nd}~ww xY wY w xY w# t        j                  $ r`}|j,                  |j,                  |_        t.        j0                  j3                  tE        |      jF                   d| d       Y d}~d}~ww xY w# d}tI        jJ                  |jL                         |dk\  r	 | j                  jO                  ||j                  
       nu# t        j                  $ r_}|j,                  |j,                  |_        t.        j0                  j3                  tE        |      jF                   d| d       Y d}~nd}~ww xY w| jQ                          w xY 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typenamerr   pytest_keyboard_interruptBaseExceptionINTERNAL_ERRORnotify_exceptionoption
SystemExitr2   __name__oschdir	startpathpytest_sessionfinish_ensure_unconfigure)configdoitru   	initstaterx   ry   excs          rc   wrap_sessionr     s    !!&)G!GI0% 	R  "IKK++G+<I!%fg!6!;!G> 
""#>C00#0B0B 1  	""$U  	!)!5!5G 	7!)!6!6G!4>>2 		,mm11>>@G)1)=)=J'--8==++7!(!9!9Jq=JJ$$(8(8'9GMM<M<M;Nb%QRKK11'1B!+G 	R!)!8!8Gmm11>>@GR''? gmmZ8JJ$$%PQ >> C>>-),G&

  DI$6$6#7r#b!ABBC	R, >> C>>-),G&

  DI$6$6#7r#b!ABBC 
""#>C00#0B0B 1  >> C>>-),G&

  DI$6$6#7r#b!ABBC 	""$s   AC 'M  <L=N6 DL=$N6 'AL=.K
:L=L6AL1,L=1L66L=9N6 <L==N6  N3AN..N36'R'PRQ8AQ3.R3Q88Rc                "    t        | t              S N)r   _mainr   s    rc   pytest_cmdline_mainr   O  s    &&re   rz   c                    | j                   j                  |       | j                   j                  |       |j                  rt        j
                  S |j                  dk(  rt        j                  S y)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)r   ru   s     rc   r   r   S  s`     KK!!'!2
KK""7"3$$$			1	$***re   c                $    | j                          y r   )perform_collectrt   s    rc   r   r   `  s    re   c                   | j                   rR| j                  j                  j                  s2| j	                  | j                    d| j                   dk7  rdnd d      | j                  j                  j
                  ryt        | j                        D ]  \  }}|dz   t        | j                        k  r| j                  |dz      nd }|j                  j                  j                  ||       | j                  r| j                  | j                        | j                  s| j	                  | j                         y)Nz errorr*   s z during collectionT)itemnextitem)r   r   r   rB   Interruptedcollectonly	enumerateitemslenr~   pytest_runtest_protocol
shouldfailr   
shouldstop)ru   ir   r   s       rc   r   r   d  s   7>>#8#8#V#V!!""#61D1D1I#r)RRde
 	
 ~~((W]]+4+,q53w}}3E+E7==Q'400dX0N..!3!344%%g&8&899 , re   c                    	 | j                  d      j                         xs  | j                  dd      j                         S # t        $ r Y yw xY 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:   s    rc   _in_venvr   w  sR    MM,'//1 @}}\95==?	
  s   A A 	AAc                <     j                   dk(  ry|j                  d j                        }|xs g }|j                  d      }|r|j	                  d |D                |v ry|j                  d j                        }|xs g }|j                  d      }|r|j	                  d	 |D               t         fd
|D              ry|j                  d      }|st               ry j                         r&|j                  d      }t         fd|D              ryy )N__pycache__Tcollect_ignorer   ignorec              3  2   K   | ]  }t        |        y wr   r   .0xs     rc   	<genexpr>z(pytest_ignore_collect.<locals>.<genexpr>  s     @ZLOZ   collect_ignore_globignore_globc              3  2   K   | ]  }t        |        y wr   r   r   s     rc   r   z(pytest_ignore_collect.<locals>.<genexpr>  s     D^LO^r   c              3  n   K   | ],  }t        j                   t              t        |             . y wr   )fnmatchr_   )r   globcollection_paths     rc   r   z(pytest_ignore_collect.<locals>.<genexpr>  s&     
U7??3/T;s   25rA   rG   c              3  6   K   | ]  }t        |        y wr   r   )r   patr   s     rc   r   z(pytest_ignore_collect.<locals>.<genexpr>  s     M;LCz#/;Ls   )	name_getconftest_pathlistparent	getoptionextendanyr   is_dirgetini)r   r   ignore_paths
excludeoptignore_globsexcludegloboptallow_in_venvnorecursepatternss   `       rc   pytest_ignore_collectr     s$   },//55 0 L  %2L!!(+J@Z@@,&//O$:$: 0 L  %2L%%m4ND^DD

U
UU$$%<=MXo6"MM/:M;LMMre   c                0    t         j                  ||       S )Nr   )Dirfrom_parentr:   r   s     rc   pytest_collect_directoryr     s     ??6?--re   c                    t        |j                  d      xs g       }|sy g }g }| D ]@  }|j                  j                  |      r|j	                  |       0|j	                  |       B |r"|j
                  j                  |       || d d  y y )Ndeselect)r   )tupler   nodeid
startswithr5   r~   pytest_deselected)r   r   deselect_prefixes	remaining
deselectedcolitems         rc   pytest_collection_modifyitemsr     s    f..z:@bAIJ>>$$%67g&W%	  %%J%7a re   c                  (    e Zd Z	 	 	 	 	 	 ddZddZy)FSHookProxyc                     || _         || _        y r   )pmremove_mods)selfr   r   s      rc   __init__zFSHookProxy.__init__  s    
 &re   c                r    | j                   j                  || j                        }|| j                  |<   |S )N)remove_plugins)r   subset_hook_callerr   __dict__)r   r   r   s      rc   __getattr__zFSHookProxy.__getattr__  s4    GG&&tD<L<L&Mdre   N)r   r   r   zAbstractSet[object]rl   None)r   r_   rl   zpluggy.HookCaller)r   
__module____qualname__r   r   re   rc   r   r     s(    '' )' 
	're   r   c                      e Zd ZdZdZy)r   z*Signals that the test run was interrupted.builtinsNr   r  r  __doc__r  re   rc   r   r     s
    4Jre   r   c                      e Zd ZdZy)r   z"Signals a stop as failed test run.Nr  r  re   rc   r   r     s    ,re   r   c                  $    e Zd ZU dZded<   ddZy)_bestrelpath_cacher   r	   r:   c                <    t        | j                  |      }|| |<   |S r   )r   r:   )r   r:   rs      rc   __missing__z_bestrelpath_cache.__missing__  s     		4(T
re   N)r:   r	   rl   r_   )r   r  r  	__slots____annotations__r  r  re   rc   r  r    s    I
Jre   r  c                  B     e Zd ZdZe	 	 	 	 	 	 d fd       ZddZ x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.
    c               &    t         |   ||      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__s      rc   r   zDir.from_parent  s     w"&t"<<re   c              #  :  K   | j                   }| j                  }t        | j                        D ]  }|j	                         rat        |j                        }| j                  j                  |d      s|j                  ||      rY|j                  ||       }|o| t|j                         st        |j                        }| j                  j                  |      s|j                  ||      r|j                  ||       }|E d {     y 7 w)NTwith_parents)r   r   r   	file_pathr   )r   ihookr   r:   r   r	   ru   
isinitpathr   r   r   pytest_collect_file)r   r   r  direntryr:   colcolss          rc   r8   zDir.collect  s      

		*H HMM*||..t$.G224PV2W 44$t4L?I!!#HMM*||..t4224PV2W 0040M! +   s   BDD5ADDD)r   nodes.Collectorr:   r	   rl   r$   )rl   z&Iterable[nodes.Item | nodes.Collector])r   r  r  r	  classmethodr   r8   __classcell__r  s   @rc   r   r     s=    	 == 	=
 
= = re   r   c                      e Zd ZU dZeZeZded<   ded<   ded<   d  fdZed!d	       Z	d"d
Z
ed#d       Zej                  d$d       Zed#d       Zej                  d$d       Zed%d       Zd&dZ ed      d'd       Z ed      d(d       ZeZdd	 	 	 	 	 d)dZd*dZ	 	 	 	 	 	 d+dZe	 d,	 	 	 	 	 d-d       Ze	 d,	 	 	 	 	 d.d       Z	 d/	 	 	 	 	 d.dZ	 d0	 	 	 	 	 d1dZd2dZd3dZ xZS )4rz   zoThe root of the collection tree.

    ``Session`` collects the initial paths given as arguments to pytest.
    r"   _setupstater%   _fixturemanagerint | ExitCodery   c           	        t         |   d|j                  d d || d       d| _        d| _        d| _        d| _        |j                  j                  j                  d      | _        t               | _        t               | _        g | _        g | _        i | _        g | _        t#        |j                        | _        | j&                  j(                  j+                  | d       y )Nr   )r   r:   fspathr   r   ru   r   r   Fr9   ru   )r   )r  r   rootpathr   r   _shouldstop_shouldfailtracerootget	frozenset_initialpaths_initialpaths_with_parents	_notfound_initial_parts_collection_cacher   r  _bestrelpathcacher   pluginmanagerregister)r   r   r  s     rc   r   zSession.__init__2  s     	 	
 ',',\\&&**<8
.7k;D;'FH8:GI')
2DV__2U!!**4i*@re   c                *    | j                  |      }|S )Nr   )_create)r  r   ru   s      rc   r{   zSession.from_configL  s    ;;f;5re   c           	         d| j                   j                   d| j                   d| j                   d| j                   d	t        | dd      z  S )N< z exitstatus=%r testsfailed=z testscollected=>ry   z<UNSET>)r  r   r   r   r   getattrr   s    rc   __repr__zSession.__repr__Q  s_    ''($)) 5++, -"112!5 D,	23 	3re   c                    | j                   S r   )r-  rB  s    rc   r   zSession.shouldstopY      re   c                t    |du r-| j                   r!t        j                  t        d      d       y || _         y )NFzCsession.shouldstop cannot be unset after it has been set; ignoring.rv   
stacklevel)r-  warningswarnr#   r   r   s     rc   r   zSession.shouldstop]  <     E>d..MMY 	  re   c                    | j                   S r   )r.  rB  s    rc   r   zSession.shouldfailk  rE  re   c                t    |du r-| j                   r!t        j                  t        d      d       y || _         y )NFzCsession.shouldfail cannot be unset after it has been set; ignoring.rv   rG  )r.  rI  rJ  r#   rK  s     rc   r   zSession.shouldfailo  rL  re   c                B    | j                   j                  j                  S )zQThe path from which pytest was invoked.

        .. versionadded:: 7.0.0
        )r   invocation_paramsr=   rB  s    rc   r   zSession.startpath}  s     {{,,000re   c                     | j                   |   S r   )r8  )r   	node_paths     rc   _node_location_to_relpathz!Session._node_location_to_relpath  s    %%i00re   T)tryfirstc                    | j                   r| j                  | j                         | j                  r| j                  | j                        y r   )r   r   r   r   rB  s    rc   pytest_collectstartzSession.pytest_collectstart  s=    ??++doo..??""4??33 re   c                    |j                   rft        |d      sY| xj                  dz  c_        | j                  j	                  d      }|r&| j                  |k\  rd| j                   d| _        y y y y y )Nwasxfailr*   r)   zstopping after z	 failures)failedhasattrr   r   getvaluer   )r   reportr)   s      rc   pytest_runtest_logreportz Session.pytest_runtest_logreport  sl    ==!<!kk**95G4++w6$3D4D4D3EY"O 7w "==re   Fr  c               x    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	   r4  r3  )r   r:   r  path_s       rc   r  zSession.isinitpath  s=    $ #4.DJD;;;;D....re   c                "   t        |t              r|n
t        |      }| j                  j                  }|j	                  |      }|j
                  j                  |      }|rt        t        ||            }|S | j                  j                  }|S r   )
r   r	   r   r9  _getconftestmodules_conftest_plugins
differencer   r   r~   )r   r+  r:   r   my_conftestmodulesr   proxys          rc   gethookproxyzSession.gethookproxy  s    #FD1vtF|[[&&  33D9**556HI&{2{'CDE  KK$$Ere   c                   ||v r||   S |j                         r6| j                  |j                        }|j                  ||       }||fnd}n7|j	                         r%| j                  |      }|j                  ||       }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   r  r  )r   rf  r   r   r   r  )r   r:   
path_cacher  r   r!  s         rc   _collect_pathzSession._collect_path  s     :d##;;=%%dkk2E*/*H*H$ +I +C 9<sfRD\\^%%d+E,,tD,ID D
4re   c                     y r   r  r   rH   genitemss      rc   r   zSession.perform_collect  s      #re   c                     y r   r  rk  s      rc   r   zSession.perform_collect  s     25re   c                N   || j                   j                  }| j                  d| |       | j                  j                  xj                  dz  c_        | j                   j
                  }g | _        g | _        i | _        g | _	        | j                  }	 g }g }|D ]  }t        | j                   j                  j                  || j                   j                  j                        }| j                  j                  |       |j                  |j                          |j                  |j                          |j#                  |j                   j$                          t'        |      | _        t'        |      | _        t-        |       }	| j.                  j1                  |	       | j                  j                  xj                  dz  c_        | j                  rMg }
| j                  D ]4  \  }}|r|
j                  d| d|d       !|
j                  d|        6 t3        |
 |s|	j4                  }nG|	j6                  r;|	j4                  D ],  }| j                  j#                  | j9                  |             . | j                   j:                  j=                          |j?                  | | j                   |	       g | _        g | _        i | _        |jA                  | 
       |rtC        |      | _"        |S # g | _        g | _        i | _        |jA                  | 
       w xY w)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.
        r   r*   	as_pypathr\  znot found: z
(no match in any of )zfound no collectors for )ru   r   r   rt   )#r   rH   r/  r0  indentr~   r5  r6  r7  r   resolve_collection_argumentrP  r=   r   pyargsr5   r:   r   rh   r2  r3  r4  r!   r  pytest_collectreportr   resultpassedrl  r9  check_pendingr   pytest_collection_finishr   r   )r   rH   rl  r~   r   initialpathsinitialpaths_with_parentsargcollection_argumentreperrors
collectorsnodes                rc   r   zSession.perform_collect  s     <;;##D

$dD1

!#{{ !#
8<

.	8')L46%&AKK1155"kk0077'#
 ##**+>?##$7$<$<=)001D1I1IJ)001D1I1I1Q1QR  "+<!8D.78Q.RD+"4(CJJ++3+7JJOO""a'"~~'+~~OC!)#.DZNRST (@&FG (6 !&))

:: #



))$--*=> !+ KK%%335..T[[ /   DN"$D%'D"))$)7"%e*D  DN"$D%'D"))$)7s   H,K; ;)L$c                    || j                   v r|r| j                   |   }|dfS t        |      }|| j                   |<   |dfS )NTF)r7  r!   )r   r  handle_dupesr  s       rc   _collect_one_nodezSession._collect_one_node>  sR    
 4)))l((.C9"4(C+.D""4(:re   c              #    K   i }| j                   j                  }| j                  D ]  }| j                  d|       | j                  j                  xj
                  dz  c_        |j                  }|j                  }|j                  }|j                         r|rJ d||f       |g}|7|j                  D ]'  }|j                  |      s ny|j                  d|       ) nd|j                  d      }	t        |j                  d      D ]:  \  }
}|
t        |	      kD  s|j                   |	|
    k7  r n|j                  d|       < d}g }| g ||fg}|r9|j#                         \  }}|s| d}t%        |t&        j(                        s:t%        |t*              r+t%        |d   t,              sJ |j/                  |d   |      }nt        |      dk(  xr( t%        |d   t,              xr |d   j1                          }| j3                  ||      \  }}|s(|j4                  s|j6                  j9                  |	       |j4                  s|j:                  }d}t=        |      D ]  }t%        |d   t,              r|j                  |d   k(  }t>        j@                  d
k(  r|stB        j                  jE                  |j                  |d         }|xrL tB        j                  jG                  |j                        tB        j                  jG                  |d         k(  }n8|jH                  |d   k(  xs$ |jH                  j                  d      d   |d   k(  }|s|jK                  ||dd  f       d} |s|jK                  |       |r9|s;djM                  tO        |      g|      }| jP                  jK                  ||f       | j                  j                  xj
                  dz  c_         y w)Nzprocessing argumentr*   zinvalid arg r   .rv   FTrq  win32[::))r   r9  r6  r/  r0  rs  r:   partsmodule_namer   rh   _is_in_confcutdirinsertsplitr   r   stempopr   r   	Collectorrz   r	   ri  r   r  rx  r  rv  rw  reversedr   platformr   samefileislinkr   r5   joinr_   r5  )r   rh  r   r~  argpathnamesr  pathsr:   module_name_partsr   any_matched_in_initial_partnotfound_collectorswork	matchnode
matchpartssubnodesr  r  	duplicateany_matched_in_collectorr  is_match	same_file
report_args                            rc   r8   zSession.collectK  s     =?
[[&&#'#6#6JJ,.ABJJOO""a'")..G'--E-99K ~~ EL'51A0D"EEyIE "#OOD//5LLD) , %0$5$5c$:!(!<GAt3011TYYBSUVTVBW5WLLD)  = +0'"$'''(QD (,
%	: "#O26/ ")U__= i1%jmT:::(66z!}jQH
 J1, 4&z!}d;4&qM113$L
 &*%;%;I|%TNC$SZZ "<<C<H:: "zzH ,1($X.D!*Q-6#'99
1#=<<728 )+(8(8JqM(RI (1 ( "tyy 9#%77>>*Q-#@!A % !IIA6 H#yys3A6*Q-G !  T:ab>$:;3703 /6 0'..y9I L /!YYG'=u'=>
%%z3F&GHJJOO""a'"_ $7s   MO;0O;A*O;c              #  4  K   | j                  d|       t        |t        j                        r!|j                  j                  |       | y t        |t        j                        sJ | j                  j                  d      }|xr t        |t        j                         }| j                  ||      \  }}|r|sy |j                  r*|j                  D ]  }| j                  |      E d {     |s|j                  j                  |       y y 7 &w)Nrl  )r   r@   rq  )r/  r   r   Itemr  pytest_itemcollectedr  r   r   Filer  rx  rw  rl  rv  )r   r  r@   r  r  r  subnodes          rc   rl  zSession.genitems  s     

:t$dEJJ'JJ+++6JdEOO444![[223CDN . O:dEJJ3OPL!33D,GNCzz"zzG#}}W555  *

//s/;  6s   C-D/D0'D)r   r   rl   r  )r   r   rl   rz   )rl   r_   )rl   
bool | str)r   r  rl   r  )rl   r	   )rR  r	   rl   r_   )rl   r  )r\  zTestReport | CollectReportrl   r  )r:   zstr | os.PathLike[str]r  rQ   rl   rQ   )r+  zos.PathLike[str]rl   zpluggy.HookRelay)r:   r	   rh  z%dict[Path, Sequence[nodes.Collector]]rl   zSequence[nodes.Collector])..)rH   Sequence[str] | Nonerl  zLiteral[True]rl   zSequence[nodes.Item])rH   r  rl  rQ   rl   z&Sequence[nodes.Item | nodes.Collector])NT)T)r  r"  r  rQ   rl   ztuple[CollectReport, bool])rl   z&Iterator[nodes.Item | nodes.Collector])r  znodes.Item | nodes.Collectorrl   zIterator[nodes.Item])r   r  r  r	  r   r   r  r   r#  r{   rC  propertyr   setterr   r   rS  r   rV  r]  rv  r  rf  ri  r   r   r  r8   rl  r$  r%  s   @rc   rz   rz   #  s   
 KF##A4  3     ! !     ! ! 1 11 t4 4 tP P 4 #	/$/ 	/
 
/0" : 
#	> JM#(#:G#	# # AD5(5:>5	/5 5
 CGP(P;?P	/Pj "  
$	w(r<re   c                4   	 t         j                  j                  |       }||j                  |j                  dk(  ry|j                  r)t        j                  j                  |j                        S |j                  S # t        t        t
        f$ r Y yw xY w)zaSearch sys.path for the given a dotted module name, and return its file
    system path if found.N	namespace)rD   util	find_specAttributeErrorImportError
ValueErrororiginsubmodule_search_locationsr   r:   dirname)r  specs     rc   search_pypathr    s~    ~~''4 |t{{*dkk[.H		(	(wwt{{++{{ K4 s   B   BBT)frozenc                  0    e Zd ZU dZded<   ded<   ded<   y)	CollectionArgumentzA resolved collection argument.r	   r:   zSequence[str]r  
str | Noner  N)r   r  r  r	  r  r  re   rc   r  r    s    )
Jre   r  Fro  c                  t        |      j                  d      \  }}}|j                  d      ^}}|r|d    | | |d<   d}|rt        |      }	|	|}|	}| |z  }
t	        |
      }
t        |
      s!|rdnd}t        |j                  |            |r1|
j                         r!|rdnd	}t        |j                  |            t        |
||
      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})r:   r  r  )
r_   	partitionr  r  r   r   r   formatr   r  )invocation_pathr}  rp  ri   squacketreststrpathr  r  pyarg_strpathr+  rr   s               rc   rt  rt    s   F s8--c2D(Djj&OGeRyk(D62b	K%g.$!K#Gw&F&!Fv  H5 	
 ,--  HN 	
 ,-- re   )ra   r   rl   r  )r:   r_   rl   r_   )r   r   r   z2Callable[[Config, Session], int | ExitCode | None]rl   r)  )r   r   rl   r)  )r   r   ru   rz   rl   zint | ExitCode | None)ru   rz   rl   r  )ru   rz   rl   rQ   )r:   r	   rl   rQ   )r   r	   r   r   rl   zbool | None)r:   r	   r   r"  rl   znodes.Collector | None)r   zlist[nodes.Item]r   r   rl   r  )r  r_   rl   r  )r  r	   r}  r_   rp  rQ   rl   r  )Xr	  
__future__r   rm   collections.abcr   r   r   r   r   AbstractSetdataclassesr   r]   rD   importlib.utilr   pathlibr	   r   typingr
   r   r   r   rI  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%   rd   r`   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	dataclassdictr_   r  	Directoryr   r  rz   r  r  rt  r  re   rc   <module>r     s   N "  $ $ $ $ .      	  
          ! ( # # . % , 4 ! ( ' & ' # ) & + % / &/@F288L88v'
&*#L.
.'..$ # -Y - dCi   0 %// 0  0 f q<eoo q< q<h$ d#  $ ;@AA #A37AAre   