
    i                      S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  SSKJ
r
  SSKrSSKrSSKrSSKrSS	KJr  SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSS
KJr  SSKrSSKJr  SSKJr  SSKJ r   SSKJ!r!  SSKJ"r"  SSKJ#r#  SSKJ$r$  SSKJ%r%  SSK&r&SSK'r'SSK'J(r(  SSK'J)r)  SSK'J*r*  SSK'J+r+  SSK'J,r,  SSK-J.r.  SSK/J0r0  SSK/J1r1  SSK2J3r3  SSK4J5r5  SSK6r4SSK6J7r7  SSK6J8r8  SS K9J:r:  SS!K;J<r<  SS"K=J>r>  SS#K=J?r?  SSK@r4SSKAr4SS$KBJCrC  SS%KBJDrD  SS&KEJFrF  SS'KEJGrG  SS(KEJHrH  SS)KEJIrI  SS*KEJJrJ  SS+KEJKrK  SS,KLJMrM  SS-KNJOrO  SS.KNJPrP  \%(       a  SS/KQJRrR  SS0KSJTrT  SS1KUJVrV  \WrX \(" S25      rY\*" S25      rZ\" " S3 S4\R                  5      5       r\ " S5 S6\]5      r^    SoS7 jr_  Sp     SqS8 jjr`SrS9 jra " S: S;5      rbSsS< jrcSsS= jrdS>re/ \eQS?PS@PSAPSBPSCPSDPSEPSFPSGPSHPSIPSJPSKPSLPSMPSNPSOPSPPSQPSRPSSPSTPSUPSVPSWP7rf1 \fkSXiSYirg  Sp     StS[ jjrhSuS] jri  Sp     SvS^ jjrjSwS_ jrk        SxS` jrl\" " Sa S\\,5      5       rm    SySb jrn " Sc Sd5      ro\o" 5       rpSzSe jrq\" " Sf SZ5      5       rrS{Sg jrs S|     S}Sh jjrtS~Si jru\" SjSk9      SSl j5       rvSSm jrw      SSn jrxg)z:Command line options, ini-file and conftest.py processing.    )annotationsN)Callable)	Generator)Iterable)Iterator)Sequence)	lru_cache)dedent)FunctionType)Any)cast)Final)final)IO)TextIO)TYPE_CHECKING)HookimplMarker)HookimplOpts)HookspecMarker)HookspecOpts)PluginManager   )PathAwareHookProxy)	PrintHelp)
UsageError)determine_setup)__version__)ExceptionInfo)filter_traceback)TracebackStyle)TerminalWriter)ArgumentParser)fail)Skipped)absolutepath)bestrelpath)import_path)
ImportMode)resolve_package_path)safe_exists)Stash)PytestConfigWarning)warn_explicit_for)AssertionRewritingHook)Cache)TerminalReporterpytestc                  0    \ rS rSrSrSrSrSrSrSr	Sr
S	rg
)ExitCode[   zEncodes the valid exit codes by pytest.

Currently users and plugins may supply other exit codes as well.

.. versionadded:: 5.0
r   r                N)__name__
__module____qualname____firstlineno____doc__OKTESTS_FAILEDINTERRUPTEDINTERNAL_ERRORUSAGE_ERRORNO_TESTS_COLLECTED__static_attributes__r;       V/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/_pytest/config/__init__.pyr5   r5   [   s(     
BLKNKrH   r5   c                  4    \ rS rSr      SS jrSS jrSrg)ConftestImportFailurer   c                   Xl         X l        g N)pathcause)selfrO   rP   s      rI   __init__ConftestImportFailure.__init__s   s     	
rH   c                z    [        U R                  5      R                   SU R                   SU R                   S3$ )N: z (from ))typerP   r<   rO   rQ   s    rI   __str__ConftestImportFailure.__str__|   s3    tzz"++,Btzzl'$))ANNrH   )rP   rO   N)rO   pathlib.PathrP   	ExceptionreturnNone)r]   str)r<   r=   r>   r?   rR   rY   rG   r;   rH   rI   rK   rK   r   s)     	
 
OrH   rK   c                    [        U 5      =(       a5    S[        U R                  5      R                  [        R
                  5      ;  $ )zFilter tracebacks entries which point to pytest internals or importlib.

Make a special case for importlib because we use it to import test modules and conftest files
in _pytest.pathlib.import_path.
	importlib)r   r_   rO   splitossep)entrys    rI   ,filter_traceback_for_conftest_import_failurerf      s3     E"W{#ejj/:O:OPRPVPV:W'WWrH   c                   [         R                  R                  S5      n [        [         R                  S'    [	        X5      n UR
                  R                  US9n [        U5      UR                  5         Uc!  [         R                  R                  SS5        $ U[         R                  S'   $ ! [         aL    Us UR                  5         Uc!  [         R                  R                  SS5        $ U[         R                  S'   $ f = f! UR                  5         f = f! [         Ga=  n[        R                  " UR                  5      n[        [         R"                  5      nUR%                  SUR&                   S3SS9  UR(                  R+                  [,        5      Ul        UR(                  (       a  UR/                  SS	S
9OUR1                  5       n[3        U5      n	U	R5                  5        H!  n
UR%                  U
R7                  5       SS9  M#     [        R8                  s SnAUc!  [         R                  R                  SS5        $ U[         R                  S'   $ SnAff = f! [:         a  n[        [         R"                  5      nUR<                   H  nUR%                  SU S3SS9  M     [        R8                  s SnAUc!  [         R                  R                  SS5        $ U[         R                  S'   $ SnAff = f! Uc!  [         R                  R                  SS5        f U[         R                  S'   f = f)a4  Perform an in-process test run.

:param args:
    List of command line arguments. If `None` or not given, defaults to reading
    arguments directly from the process command line (:data:`sys.argv`).
:param plugins: List of plugin objects to be auto-registered during initialization.

:returns: An exit code.
PYTEST_VERSIONconfigNz$ImportError while loading conftest 'z'.T)redshortF)stylechainzERROR: 
)rc   environgetr   _prepareconfighookpytest_cmdline_mainr5   _ensure_unconfigurepop
ValueErrorrK   r   from_exceptionrP   r!   sysstderrlinerO   	tracebackfilterrf   getreprexconlyr_   
splitlinesrstriprE   r   args)r   pluginsold_pytest_versionrj   reteexc_infotwexc_reprformatted_tbr{   msgs               rI   mainr      s    (89&>'2

#$	-#D2F$-&,kk&E&EV&E&T#C= **, %JJNN+T2+=BJJ'( " J**, %JJNN+T2+=BJJ'( **,1 % 	($33AGG<H

+BGG:166("E4GP!)!3!3!:!:<"H
 %%   we <%%' 
 x=L$//140 2'''  %JJNN+T2+=BJJ'(E	(2  $CJJ'66CGGgcU"%4G0 ###%JJNN+T2+=BJJ'($ %JJNN+T2+=BJJ'(s   I* D D
 
B1 )I* 1D=D
 >I* DD
 
DI* I'*C;I"%I'&I* "I''I* *
L4AL LL  LL 9Mc                 D    [        5       n [        R                  R                  5         U $ ! [         ai    [
        R                  " [
        R                  [
        R                  5      n[
        R                  " U[        R                  R                  5       5         gf = f)zgThe CLI entry point of pytest.

This function is not meant for programmable use; use `main()` instead.
r   )r   ry   stdoutflushBrokenPipeErrorrc   opendevnullO_WRONLYdup2fileno)coder   s     rI   console_mainr      sj    	v

  ''"**bkk2
**,-s   ), A0BBc                  $    \ rS rSr\" \5      rSrg)cmdline   r;   N)r<   r=   r>   r?   staticmethodr   rG   r;   rH   rI   r   r      s    DrH   r   c                n    [         R                  R                  U 5      (       a  [        U SU  35      eU $ )zhArgparse type validator for filename arguments.

:path: Path of filename.
:optname: Name of the option.
z must be a filename, given: rc   rO   isdirr   rO   optnames     rI   filename_argr      s3     
ww}}TG9$@GHHKrH   c                n    [         R                  R                  U 5      (       d  [        U SU  35      eU $ )zjArgparse type validator for directory arguments.

:path: Path of directory.
:optname: Name of the option.
z must be a directory, given: r   r   s     rI   directory_argr      s3     77==G9$A$HIIKrH   )markr   runnerfixtures
helpconfigpythonterminal	debuggingunittestcaptureskipping
legacypathtmpdirmonkeypatchrecwarnpastebin	assertionjunitxmldoctestcacheproviderfreeze_support	setuponly	setupplanstepwiseunraisableexceptionthreadexceptionwarningsloggingreportsfaulthandlerpytesterpytester_assertionsConfigc           	         [        5       n[        U[        R                  U =(       d    SU[        R                  R                  5       S9S9nU b  UR                  U SS9  [         H  nUR                  U5        M     U$ )Nr;   r   r   dirinvocation_paramsTexclude_only)	PytestPluginManagerr   InvocationParamspathlibPathcwdconsider_preparsedefault_pluginsimport_plugin)r   r   pluginmanagerrj   specs        rI   
get_configr     s    
 ()M 11  " 2 
F ''4'@##D)   MrH   r   c                 *    [        5       R                  $ )zObtain a new instance of the
:py:class:`pytest.PytestPluginManager`, with default plugins
already loaded.

This function can be used by integration with other tools, like hooking
into pytest to run tests into an IDE.
)r   r   r;   rH   rI   get_plugin_managerr   4  s     <%%%rH   c                J   U c  [         R                  SS  n Or[        U [        R                  5      (       a  [        R
                  " U 5      /n O;[        U [        5      (       d&  Sn[        UR                  U [        U 5      5      5      e[        X5      nUR                  n U(       aB  U H<  n[        U[        5      (       a  UR                  U5        M+  UR                  U5        M>     UR                  R!                  X@S9nU$ ! ["         a    UR%                  5         e f = f)Nr   zG`args` parameter expected to be a list of strings, got: {!r} (type: {}))r   r   )ry   argv
isinstancerc   PathLikefspathlist	TypeErrorformatrW   r   r   r_   consider_pluginargregisterrs   pytest_cmdline_parseBaseExceptionru   )r   r   r   rj   r   plugins         rI   rr   rr   ?  s     |xx|	D"++	&	&		$ d##U 	 

4d455&F((M!fc**!44V<!**62	 "
 ##88' 9 
  ""$s   "A#D D"c                H    U R                  5       (       a  U R                  $ U $ )z<Get the directory of a path - itself if already a directory.)is_fileparent)rO   s    rI   _get_directoryr   _  s    ||~~{{rH   c                @   [         (       a  [        R                  " U 5      (       d   e[        U S/ 5       Vs1 s H  o3R                  iM     nn/ n0 nU H[  n[        X[
        5      nU[
        La  UR                  U SU 35        SXg'   M8  Xt;   a  UR                  U S35        SXg'   MW  SXg'   M]     U(       a^  SR                  U5      n	[        R                  R                  R                  UU R                  U	S9n
[        [        [        U 5      U
5        U$ s  snf )N
pytestmark=Tz=TrueF, )rW   fullname	hook_opts)r   inspect	isroutinegetattrnameAttributeErrorappendjoin_pytest
deprecatedHOOK_LEGACY_MARKINGr   r>   r/   r   r   )method	hook_type	opt_namesmknown_marks	must_warnoptsopt_nameopt_attrr   messages              rI   _get_legacy_hook_marksr  g  s   
 }  ((((-4V\2-NO-NVV-NKOID6^<>)z8*56!DN$z/0!DN"DN  IIi(	$$88??(( @ 

 	$|V4g>K+ Ps   Dc                    ^  \ rS rSrSrSU 4S jjr      SU 4S jjrSU 4S jjrSS U 4S jjjrS!S jr	S"S jr
S#S	 jr                  S$S
 jrS%S jr          S&S jr          S'S jrS(S jr      S)S jr          S*S jr      S+S jrSS.     S,S jjrS-S jr      S.S jrSS jrS/S jr    S0S jrS1S2S jjrSrU =r$ )3r   i  a'  A :py:class:`pluggy.PluginManager <pluggy.PluginManager>` with
additional pytest-specific functionality:

* Loading plugins from the command line, ``PYTEST_PLUGINS`` env variable and
  ``pytest_plugins`` global variables found in plugins being loaded.
* ``conftest.py`` loading during start-up.
c                  > SSK Jn  SSK Jn  [        TU ]  S5        [        5       U l        0 U l        S U l        SU l	        [        S5      " [        5      U l        / U l        U R                  [        R                  5        U R!                  U 5        ["        R$                  R'                  S5      (       a  [(        R*                  n[-        USS	5      n [/        ["        R0                  " UR3                  5       5      UR4                  S
US9nU R8                  R:                  R=                  UR>                  5        U RA                  5         U" 5       U l!        SU l"        g ! [6         a     N_f = f)Nr   )DummyRewriteHook)RewriteHookr3   F   PYTEST_DEBUGencodingutf8r   )mode	bufferingr
  )#_pytest.assertionr  r  superrR   set_conftest_plugins_dirpath2confmods_confcutdir_noconftestr	   r   skipped_pluginsadd_hookspecsr   hookspecr   rc   rp   rq   ry   rz   r   r   dupr   r  r\   traceroot	setwriterwriteenable_tracingrewrite_hook_configured)rQ   r  r  errr
  	__class__s        rI   rR   PytestPluginManager.__init__  s$   61" 9< NP04 
 (n^< 797++,d::>>.))::C#CV<HFF3::<(%	 JJOO%%cii0! *:);   s   8E 
E,+E,c                   > UR                  S5      (       d  gUS:X  a  g[        TU ]	  X5      nUb  U$ [        X5      n[        R
                  " U5      (       d  g[        USS5      n[        [        U5      $ ):meta private:pytest_Npytest_pluginsimpl)tryfirsttrylastoptionalhookhookwrapper)	
startswithr  parse_hookimpl_optsr   r   r   r  r   r   )rQ   r   r   r   r   legacyr!  s         rI   r-  'PytestPluginManager.parse_hookimpl_opts  s|     y))##w*68K&  (('FR
 L&))rH   c                   > [         TU ]  X5      nUc>  [        X5      nUR                  S5      (       a  [	        USS5      n[        [        U5      nU$ )r$  r%  r   )firstresulthistoric)r  parse_hookspec_optsr   r,  r  r   r   )rQ   module_or_classr   r   r   r.  r!  s         rI   r3  'PytestPluginManager.parse_hookspec_opts  sU    w*?A<_3Fy))/F$? L&1rH   c           
       > U[         R                  R                  ;   a?  [        R                  " [        SR                  UR                  SS5      5      5      5        g [        TU ]%  X5      nUb\  U R                  R                  R                  [        UUU S9S9  [        U[        R                   5      (       a  U R#                  U5        U$ )NzQ{} plugin has been merged into the core, please remove it from your requirements._-)r   plugin_namemanagerkwargs)r   r   DEPRECATED_EXTERNAL_PLUGINSr   warnr.   r   replacer  r   rs   pytest_plugin_registeredcall_historicdictr   types
ModuleTypeconsider_module)rQ   r   r   r9  r!  s       rI   r   PytestPluginManager.register  s    7%%AAAMM#??EvS#.@ g&v4"II..<<! +  =  &%"2"233$$V,rH   c                (    U R                  U5      nU$ rN   )
get_plugin)rQ   r   r   s      rI   	getpluginPytestPluginManager.getplugin  s    '+t'<rH   c                6    [        U R                  U5      5      $ )z:Return whether a plugin with the given name is registered.)boolrH  )rQ   r   s     rI   	haspluginPytestPluginManager.hasplugin
  s    DOOD)**rH   c                Z    UR                  SS5        UR                  SS5        SU l        g)r$  markersztryfirst: mark a hook implementation function such that the plugin machinery will try to call it first/as early as possible. DEPRECATED, use @pytest.hookimpl(tryfirst=True) instead.ztrylast: mark a hook implementation function such that the plugin machinery will try to call it last/as late as possible. DEPRECATED, use @pytest.hookimpl(trylast=True) instead.TN)addinivalue_liner  )rQ   rj   s     rI   pytest_configure$PytestPluginManager.pytest_configure  s>     	G	
 	F	
  rH   c               P   U(       a  [        Xe-  5      OSU l        X0l        X l        Sn	U H]  n
[	        U
5      nUR                  S5      nUS:w  a  USU n[        Xk-  5      n[        U5      (       d  MI  U R                  UUUUS9  Sn	M_     U	(       d  U R                  UUUUS9  gg)a8  Load initial conftest files given a preparsed "namespace".

As conftest files may add their own command line options which have
arguments ('--my-opt somepath') we might get some false positives.
All builtin and 3rd party plugins will have been loaded, however, so
common options will not confuse our logic here.
NF::consider_namespace_packagesT)r'   r  r  _using_pyargsr_   findr,   _try_load_conftest)rQ   r   pyargs
noconftestrootpath
confcutdirinvocation_dir
importmoderX  foundanchorinitial_pathrO   ianchors                 rI   _set_initial_conftests*PytestPluginManager._set_initial_conftests#  s    ( :DL45 	 &# L|$D		$ABwBQx!."78F 6""''0K	 (  ## !$ ##,G	 $  rH   c                N    U R                   c  gXR                   R                  ;  $ )z:Whether to consider the given path to load conftests from.T)r  parentsrQ   rO   s     rI   _is_in_confcutdir%PytestPluginManager._is_in_confcutdirV  s(    # ++3333rH   c                   U R                  UUUUS9  UR                  5       (       aB  UR                  S5       H,  nUR                  5       (       d  M  U R                  UUUUS9  M.     g g )NrW  ztest*)_loadconftestmodulesis_dirglob)rQ   re  ra  r^  rX  xs         rI   r[  &PytestPluginManager._try_load_confteste  sr     	!!(C	 	" 	
 ==??[[)88::--" 4O	 .  * rH   c               x   U R                   (       a  g U R                  U5      nXPR                  ;   a  g / n[        U/UR                  Q75       HZ  nU R                  U5      (       d  M  US-  nUR                  5       (       d  M7  U R                  UUUUS9n	UR                  U	5        M\     X`R                  U'   g )Nzconftest.pyrW  )	r  r   r  reversedri  rk  r   _importconftestr   )
rQ   rO   ra  r^  rX  	directoryclistr   conftestpathmods
             rI   rn  (PytestPluginManager._loadconftestmodules~  s     ''-	 ...	>I,=,=>?F%%f--%5''))..$" 4O	 / C LL% @ -2y)rH   c                \    U R                  U5      nU R                  R                  US5      $ )Nr;   )r   r  rq   )rQ   rO   rv  s      rI   _getconftestmodules'PytestPluginManager._getconftestmodules  s+    ''-	%%)))R88rH   c                    U R                  U5      n[        U5       H  n U[        XA5      4s  $    [	        U5      e! [         a     M-  f = frN   )r|  rt  r   r   KeyError)rQ   r   rO   modulesry  s        rI   _rget_with_confmod&PytestPluginManager._rget_with_confmod  sX    
 **40G$CGC... %
 tn " s   =
A
Ac          
        [        U5      nU R                  U5      nUb  [        [        R                  U5      $ [        U5      nUc   [        R                  UR                  	  [        UUUUS9nU R                  X5        U R                  R!                  U5        UR"                  n
XR$                  ;   ao  U R$                  R'                  5        HQ  u  pXR(                  ;   d  X:X  d  M  X;   a   [+        SU< SU SUR,                   S35      eUR/                  U5        MS     U R1                  SU< 35        U R3                  XS9  U$ ! [         a     Nf = f! [         a  n	U	R                  c   e[        XS9U	eS n	A	ff = f)	N)r  r  rX  )rP   z#While trying to load conftest path z, found that the module z is already loaded with path zE. This is not supposed to happen. Please report this issue to pytest.zloading conftestmodule )registration_name)r_   rH  r   rC  rD  r+   ry   r  stemr  r)   r\   __traceback__rK   _check_non_top_pytest_pluginsr  addr   r  itemsri  AssertionError__file__r   r  consider_conftest)rQ   rx  ra  r^  rX  conftestpath_plugin_nameexistingpkgpathry  r   dirpathrO   modss                rI   ru  #PytestPluginManager._importconftest  s    $'|#4 ??#;<(((33 '|4?KK 1 12		F,G	C 	**3=""3'%%,,,"44::<
ll*do{,A,AQ R558E9VWZWcWcVd ebb 
 KK$ = 	

,SG45sO
=    	F??...'>AE	Fs*   	E %E 
EE
F'F  Fc                    [        US5      (       aJ  U R                  (       a8  U R                  (       d&  Sn[        UR	                  X R
                  5      SS9  g g g g )Nr&  af  Defining 'pytest_plugins' in a non-top-level conftest is no longer supported:
It affects the entire test suite instead of just below the conftest as expected.
  {}
Please move it to a top level conftest file at the rootdir:
  {}
For more information, visit:
  https://docs.pytest.org/en/stable/deprecations.html#pytest-plugins-in-non-top-level-conftest-filesF)pytrace)hasattrr  rY  r%   r   r  )rQ   ry  rx  r   s       rI   r  1PytestPluginManager._check_non_top_pytest_plugins  sY     C)**  &&w  L*:*:;UK ' ! +rH   Fr   c               r   Sn[        U5      nX4:  a  X   nUS-  n[        U[        5      (       ao  US:X  a   X   nUS-  nOUR	                  S5      (       a  USS nOMR  UR                  5       nU(       a  UR	                  S5      (       d  M  U R                  U5        X4:  a  M  gg! [         a     gf = f)r$  r   r   z-pNr7   no:)lenr   r_   
IndexErrorr,  stripr   )rQ   r   r   rd  noptpargs          rI   r   %PytestPluginManager.consider_preparse  s     Ie'CFA#s##$;#w FA^^D))qr7Dzz|(>(>''-# e & s   B) )
B65B6c                   UR                  S5      (       a  USS nU[        ;   a  [        SU S35      eUS:X  a"  U R                  S5        U R                  S5        U R                  U5        UR                  S	5      (       d  U R                  S	U-   5        ggUnU R	                  U5        UR                  S	5      (       d  U R	                  S	U-   5        U R                  US
S9  g)r$  r  r8   Nzplugin z cannot be disabledr   r   pytest_stepwiser%  T)consider_entry_points)r,  essential_pluginsr   set_blockedunblockr   )rQ   argr   s      rI   r   &PytestPluginManager.consider_pluginarg  s    >>%  qr7D(( 74&0C!DEE &  ,  !23T"??9--  T!12 . DLL??9--Y-.s$?rH   c                "    U R                  XS9  g)r$  r   N)r   )rQ   conftestmoduler  s      rI   r  %PytestPluginManager.consider_conftest.  s     	n=rH   c                `    U R                  [        R                  R                  S5      5        g)r$  PYTEST_PLUGINSN)_import_plugin_specsrc   rp   rq   rX   s    rI   consider_env PytestPluginManager.consider_env4  s    !!"**..1A"BCrH   c                <    U R                  [        US/ 5      5        g)r$  r&  N)r  r   )rQ   ry  s     rI   rE  #PytestPluginManager.consider_module8  s    !!'#/?"DErH   c                N    [        U5      nU H  nU R                  U5        M     g rN   )_get_plugin_specs_as_listr   )rQ   r   r   import_specs       rI   r  (PytestPluginManager._import_plugin_specs<  s&     ,D1"K{+ #rH   c                   [        U[        5      (       d   SU< 35       eU R                  U5      (       d  U R                  U5      b  gU[        ;   a  SU-   OUnU R
                  R                  U5        U(       a  U R                  SUS9nU(       a  g [        U5        [        R                  U   nU R                  XQ5        g! [         a=  n[        SU SUR                  S    35      R                  UR                  5      UeSnAf[          a9  nU R"                  R%                  XR&                  =(       d    S	45         SnAgSnAff = f)
zImport a plugin with ``modname``.

If ``consider_entry_points`` is True, entry point names are also
considered to find a plugin.
z"module name as text required, got Nz_pytest.pytest11r  zError importing plugin "z": r    )r   r_   
is_blockedrH  builtin_pluginsr  mark_rewriteload_setuptools_entrypoints
__import__ry   r  r   ImportErrorr   with_tracebackr  r&   r  r   r   )rQ   modnamer  
importspecloadedry  r   s          rI   r   !PytestPluginManager.import_pluginC  s.    '3'' 	
0<	
' ??7##tw'?'K-4-GZ')W
&&z2 55jw5OF	(z" ++j)CMM#'  	5*7)3qvvaykBnQ__-15  	@  ''%%+2(>??	@s$   C 
E8DE/E		E)	r  r  r  r  r   r  rY  r  r  r]   r^   )r   _PluggyPluginr   r_   r]   zHookimplOpts | None)r   r_   r]   zHookspecOpts | NonerN   )r   r  r   
str | Noner]   r  r   r_   )r   r_   r]   rL  )rj   r   r]   r^   )r   zSequence[str | pathlib.Path]r\  rL  r]  rL  r^  r[   r_  pathlib.Path | Noner`  r[   ra  zImportMode | strrX  rL  r]   r^   )rO   r[   r]   rL  )
re  r[   ra  str | ImportModer^  r[   rX  rL  r]   r^   )
rO   r[   ra  r  r^  r[   rX  rL  r]   r^   )rO   r[   r]   zSequence[types.ModuleType])r   r_   rO   r[   r]   ztuple[types.ModuleType, Any])
rx  r[   ra  r  r^  r[   rX  rL  r]   types.ModuleType)ry  r  rx  r[   r]   r^   )r   Sequence[str]r   rL  r]   r^   )r  r_   r]   r^   )r  r  r  r_   r]   r^   )ry  r  r]   r^   )r   -None | types.ModuleType | str | Sequence[str]r]   r^   )F)r  r_   r  rL  r]   r^   )r<   r=   r>   r?   r@   rR   r-  r3  r   rI  rM  rR  rf  rk  r[  rn  r|  r  ru  r  r   r   r  r  rE  r  r   rG   __classcell__)r!  s   @rI   r   r     s	   2!h*#*+.*	*6
 2
+ *1*1 1 	1
 1 (1 %1 %1 &*1 
1f4 % 	 &* 
222 %2 	2 &*2 
2@9  
&	3"3 %3 	3 &*3 
3jLL #L 
	L6 <A.!.48.	.2@.>.>CF>	>DF,A,	,#( #(rH   c                2   U c  / $ [        U [        R                  5      (       a  / $ [        U [        5      (       a  U (       a  U R	                  S5      $ / $ [        U [
        R                  R                  5      (       a  [        U 5      $ [        SU < 35      e)z:Parse a plugins specification into a list of plugin names.,zWPlugins may be specified as a sequence or a ','-separated string of plugin names. Got: )
r   rC  rD  r_   rb   collectionsabcr   r   r   )specss    rI   r  r  i  s    
 }	%))**	%#(u{{30b0%1122E{

abgajk rH   c                      \ rS rSrS rSrg)Notseti~  c                    g)Nz<NOTSET>r;   rX   s    rI   __repr__Notset.__repr__  s    rH   r;   N)r<   r=   r>   r?   r  rG   r;   rH   rI   r  r  ~  s    rH   r  c              #    #    [        U 5      n SnU  H  nSU;  =(       a    UR                  S5      nUR                  S5      S:H  =(       a    UR                  S5      nU(       aI  [        R                  R                  U5      u  pVUS:w  a   UR                  S5      (       d  SnUv   M  M  M  U(       d  M  [        R                  R                  U5      nSnUv   M     U(       df  / nU  HB  nUR                  S5      n	SR                  U	SS	 5      n
U
(       d  M1  UR                  U
5        MD     U(       a  [        U5       S	h  vN   g	g	g	 N7f)
a  Given an iterable of file names in a source distribution, return the "names" that should
be marked for assertion rewrite.

For example the package "pytest_mock/__init__.py" should be added as "pytest_mock" in
the assertion rewrite mechanism.

This function has to deal with dist-info based distributions and egg based distributions
(which are still very much in use for "editable" installs).

Here are the file names as seen in a dist-info based distribution:

    pytest_mock/__init__.py
    pytest_mock/_version.py
    pytest_mock/plugin.py
    pytest_mock.egg-info/PKG-INFO

Here are the file names as seen in an egg based distribution:

    src/pytest_mock/__init__.py
    src/pytest_mock/_version.py
    src/pytest_mock/plugin.py
    src/pytest_mock.egg-info/PKG-INFO
    LICENSE
    setup.py

We have to take in account those two distribution flavors in order to determine which
names should be considered for assertion rewriting.

More information:
    https://github.com/pytest-dev/pytest-mock/issues/167
F/z.pyr   z__init__.pysetup__editable__TN)r   endswithcountrc   rO   splitextr,  dirnamerb   r   r   _iter_rewritable_modules)package_files	seen_somefnis_simple_module
is_packagemodule_namer7  package_namenew_package_filespartsnew_fns              rI   r  r    s3    @ 'MIb=?R[[-?XXc]a'FBKK,F
WW--b1NK g%k.D.D^.T.T 	!! /U% Z77??2.LI   BHHSMEXXeABi(Fv!((0	  
 /0ABBB   Cs   B1E7A!E*EEEc                  >   \ rS rSr% Sr\\R                  " SS9 " S S5      5       5       r " S S\	R                  5      rS	\S
'   SS.     SCS jjr\SDS j5       r\SES j5       rSFS jrSGS jrSGS jrSHS jr      SIS jr SJ     SKS jjrSLS jr\SMS j5       rSNS jr\" SS9SOS j5       rSPS jrSPS jr      SQS jrSGS jr SGS jr!SRS  jr"              SSS! jr#STSUS" jjr$\" SS#9SVS$ j5       r%SGS% jr&SGS& jr'SGS' jr(SWS( jr)SXS) jr*STSUS* jjr+SYS+ jr,SZS, jr-S[S- jr.S\S. jr/S]S/ jr0      S^S0 jr1S_S1 jr2\3S24S`S3 jjr4SJS]S4 jjr5SJS]S5 jjr6S6r7S7\S8'   S9r8S7\S:'   S;r9S7\S<'   SJSaS= jjr:\;SbS> j5       r<\;ScS? j5       r=SdS@ jr>SGSA jr?SBr@g)er   i  a  Access to configuration values, pluginmanager and plugin hooks.

:param PytestPluginManager pluginmanager:
    A pytest PluginManager.

:param InvocationParams invocation_params:
    Object containing parameters regarding the :func:`pytest.main`
    invocation.
T)frozenc                  X    \ rS rSr% SrS\S'    S\S'    S\S'            SS	 jrS
rg)Config.InvocationParamsi  ab  Holds parameters passed during :func:`pytest.main`.

The object attributes are read-only.

.. versionadded:: 5.1

.. note::

    Note that the environment variable ``PYTEST_ADDOPTS`` and the ``addopts``
    ini option are handled by pytest, not being included in the ``args`` attribute.

    Plugins accessing ``InvocationParams`` must be aware of that.
tuple[str, ...]r   $Sequence[str | _PluggyPlugin] | Noner   r[   r   c                   [         R                  U S[        U5      5        [         R                  U SU5        [         R                  U SU5        g )Nr   r   r   )object__setattr__tuple)rQ   r   r   r   s       rI   rR    Config.InvocationParams.__init__  s>     tVU4[9tY8tUC0rH   r;   N)r   Iterable[str]r   r  r   r[   r]   r^   )r<   r=   r>   r?   r@   __annotations__rR   rG   r;   rH   rI   r   r    sQ    	 J55-[		1  		1 :			1
 		1 		1rH   r   c                      \ rS rSrSr\R                  " 5       r\R                  " 5       r\r	\R                  " 5       r
Srg)Config.ArgsSourcei  zCIndicates the source of the test arguments.

.. versionadded:: 7.2
r;   N)r<   r=   r>   r?   r@   enumautoARGSINVOCATION_DIRINCOVATION_DIR	TESTPATHSrG   r;   rH   rI   
ArgsSourcer    s/    	 yy{'IIK	rH   r  r1   cacheNr   c               n   SSK Jn  SSK Jn  Uc-  U R                  SS [        R
                  R                  5       S9n[        R                  " 5       U l	         X l
         UnU" SU SU S3U R                  S	S
9U l        Xl         [        5       U l         U R                  U l        U R                  R"                  R$                  R'                  S5      U l        [)        U R                  R*                  5      U l        0 U l        SU l        0 U l        [2        R4                  " 5       U l        U R                  R9                  U S5        SU l        U R*                  R<                  R?                  [A        U R                  U R                  S9S9  [B        RD                  RF                  U l$        / U l%        g )Nr   )FILE_OR_DIRr#   r;   r   z%(prog)s [options] [z] [z] [...]T)usage
processopt	_ispytestrj   pytestconfigF)parserr   r;  )&
argparsingr  r$   r   r   r   r   argparse	Namespaceoptionr   _processopt_parserr   r-   stash_storer  r  rq   r   rs   	_inicache_override_ini	_opt2dest
contextlib	ExitStack_cleanup_stackr   r  pytest_addoptionrA  rB  r   r  r  args_sourcer   )rQ   r   r   r  r$   _as         rI   rR   Config.__init__  s    	,&$ $ 5 57<<+;+;+= !6 ! ((*	
 "3	
 (Ct7;''

 +	
 W
	 jj''--2266x@
&89K9K9P9P&Q	)+,.)+(224##D.9 		""00t||4;M;MN 	1 	
 ",,11!	rH   c                    U R                   $ )zVThe path to the :ref:`rootdir <rootdir>`.

:type: pathlib.Path

.. versionadded:: 6.1
)	_rootpathrX   s    rI   r^  Config.rootpathD  s     ~~rH   c                    U R                   $ )zHThe path to the :ref:`configfile <configfiles>`.

.. versionadded:: 6.1
)_inipathrX   s    rI   inipathConfig.inipathN  s     }}rH   c                :    U R                   R                  U5        g)zqAdd a function to be called when the config object gets out of
use (usually coinciding with pytest_unconfigure).
N)r  callback)rQ   funcs     rI   add_cleanupConfig.add_cleanupV  s     	$$T*rH   c                    U R                   (       a   eSU l         U R                  R                  R                  [	        U S9S9  g )NTri   r;  )r  rs   rR  rA  rB  rX   s    rI   _do_configureConfig._do_configure\  s9    ####		""00D8I0JrH   c                :    U R                   (       a<  SU l          U R                  R                  U S9  / U R                  R                  l         U R
                  R                  5         [        R                  " 5       U l        g ! / U R                  R                  l        f = f! [        R                  " 5       U l        f = f!  U R
                  R                  5         [        R                  " 5       U l        f ! [        R                  " 5       U l        f = f= f)NFri   )	r  rs   pytest_unconfigurerR  _call_historyr  closer  r  rX   s    rI   ru   Config._ensure_unconfigurea  s    	=#( BII000=?ADII..<=##))+&0&:&:&<# @BDII..<
 '1&:&:&<#=##))+&0&:&:&<#j&:&:&<#sE   C B C B% B""C %CDC; D;DDc                Z    U R                   R                  S5      nUc   eUR                  $ )Nterminalreporter)r   rH  _tw)rQ   r1  s     rI   get_terminal_writerConfig.get_terminal_writero  s6    484F4F4Q4Q5
  +++###rH   c                    U R                  U5        U $ ! [         a    [        U R                  SS5      (       d  SU;   a  SSKJn  U" U 5        e [        U R                  SS5      (       d  SU;   d  SU;   aG  U R                  R                  5       R                  5         [        R                  R                  S	5        e f = f)
NversionFz	--versionr   )showversionhelpz--helpz-hz8
NOTE: displaying only minimal help due to UsageError.

)parser   r   r  _pytest.helpconfigr7  r  
_getparser
print_helpry   r   r  )rQ   r   r   r7  s       rI   r   Config.pytest_cmdline_parsev  s    	JJt& %  	 t{{Iu559L:D!  VU33x47G4SW<'')446

  Q !	s
    B,Cc                   U(       a  [        USS5      (       a  SnOSnUR                  S[        USS5      US9nU R                  R                  XAS9n[	        U5      (       dc  [        U5      R                  S	5       HD  n[        R                  R                  S
U S	35        [        R                  R                  5         MF     g g )N	fulltraceFlongnativeT
showlocals)funcargsrB  rm   )excreprexcinforo   zINTERNALERROR> )r   r~   rs   pytest_internalerroranyr_   rb   ry   rz   r  r   )rQ   rE  r  rm   rD  resr{   s          rI   notify_exceptionConfig.notify_exception  s    
 gfk599$*EE//gflE&JRW " 
 ii,,W,N3xxG**40

  ?4&!;<

  " 1 rH   c                    U R                   R                  U R                  :w  aU  UR                  S5      tp#U R                  U-  n[	        U R                   R                  U5      nSR                  U/UQ5      nU$ )NrU  )r   r   r^  rb   r(   r   )rQ   nodeidbase_path_partnodeid_partfullpathrelative_paths         rI   cwd_relative_nodeidConfig.cwd_relative_nodeid  sl    !!%%6+1<<+=(N}}~5H'(>(>(B(BHMMYY<<=FrH   c                    [        U5      nUR                  R                  R                  U5        UR	                  USS9  UR                  R
                   H  nUR                  R                  U5        M      U$ )z$Constructor usable for subprocesses.Faddopts)r   r  __dict__updater9  r   r   r   )clsoption_dictr   rj   rq  s        rI   fromdictargsConfig.fromdictargs  sc     D!%%k2T5)&&A  33A6 'rH   c                <   UR                   UR                  -    H  nUR                  U R                  U'   M     [	        US5      (       aR  [	        U R
                  UR                  5      (       d,  [        U R
                  UR                  UR                  5        g g g )Ndefault)_short_opts
_long_optsdestr  r  r  setattrr]  )rQ   r  r   s      rI   r  Config._processopt  sq    OOcnn4D#&88DNN4  5 3	""4;;11SXXs{{; 2 #rH   )r)  c                   UR                  UR                  R                  UR                  R                  UR	                  S5      UR
                  R                  UR                  SS9u  p#U R                  R                  UUR                  R                  UR                  R                  UR                  UR                  R                  UR
                  R                  UR                  R                  UR	                  S5      S9  g )N	testpathsFr   r\  rd  r`  r^  r>  rX  )r   r\  r]  r^  r_  r`  ra  rX  )_decide_argsknown_args_namespacefile_or_dirr\  getinir   r   r^  r   rf  r]  r_  ra  )rQ   early_configr   r  s       rI   pytest_load_initial_conftests$Config.pytest_load_initial_conftests  s     )5522>>44;;"))+6'99==!** 6 
 	1144;;#88CC!**#88CC'99==#88CC(4(;(;-) 	2 	
rH   c                   U R                   R                  U[        R                  " U R                  5      S9u  p#[	        UR
                  UR                  U-   UR                  =(       d    S U R                  R                  S9u  pEnX@l
        XPl        X`l        [        U R                  5      U R                   R                  S'   [        U R                   5      U R                   R                  S'   U R                   R#                  SSS5        U R                   R#                  SS	5        U R                   R#                  S
SS/ S9  U R                   R#                  SSS/ S9  UR$                  =(       d    SU l        g )N	namespace)inifiler   rootdir_cmd_argr`  rootdirrp  rU  zExtra command line optionsr   
minversionz!Minimally required pytest version
pythonpathpathszAdd paths to sys.path)rW   r8  r]  required_pluginsz.Plugins that must be present for pytest to run)rW   r]  r;   )r  parse_known_and_unknown_argscopyr  r   inifilenamerh  rr  r   r   r  r   inicfgr_   r^  
extra_infor!  addinioverride_inir  )rQ   r   nsunknown_argsr^  r!  rz  s          rI   _initiniConfig._initini  s@   <<DDDIIdkk2 E 
 %4NN,.JJ.$1155	%
!6 "-0-?	*-0->	*I'CVLL*MNw-Db 	 	
 	<	 	 	
  __2rH   c                   U R                   R                  U5      u  p#[        USS5      n[        USS5      =(       d(    [        [        R
                  R                  S5      5      nUS:X  a1  SSKn UR                  R                  U 5      nU R                  Xu5        U R                  U5        g! [         a    Sn N f = f)	zInstall the PEP 302 import hook if using assertion rewriting.

Needs to parse the --assert=<mode> option from the commandline
and find all the installed plugins to mark them for rewriting
by the importhook.

assertmodeplaindisable_plugin_autoloadFPYTEST_DISABLE_PLUGIN_AUTOLOADrewriter   N)r  rw  r   rL  rc   rp   rq   r  r   install_importhook_mark_plugins_for_rewriteSystemError_warn_about_missing_assertion)rQ   r   r~  r  r  disable_autoloadr   rs   s           rI   _consider_importhookConfig._consider_importhook  s      <<DDTJr<1"2'@%H 
DJJNN;<M
 9$G((;;DA ..tF**40	  s   2B0 0B?>B?c                    XR                   l        U(       a  gS [        R                  R	                  5        5       n[        U5       H  nUR                  U5        M     g)z{Given an importhook, mark for rewrite any top-level
modules or packages in the distribution package for
all pytest plugins.Nc              3     #    U  HP  n[        S  UR                   5       5      (       d  M&  UR                  =(       d    /   H  n[        U5      v   M     MR     g7f)c              3  >   #    U  H  oR                   S :H  v   M     g7f)r  N)group).0eps     rI   	<genexpr>=Config._mark_plugins_for_rewrite.<locals>.<genexpr>.<genexpr>  s     F4Eb88z)4Es   N)rG  entry_pointsfilesr_   )r  distfiles      rI   r  3Config._mark_plugins_for_rewrite.<locals>.<genexpr>  sS      
:FD4E4EFF  

(b( II ) :s
   %A/A)r   r  ra   metadatadistributionsr  r  )rQ   rs   r  r  r   s        rI   r   Config._mark_plugins_for_rewrite  sU     +/' 
!**88:
 -];Dd# <rH   c                    [        U R                  S5      5       H,  n[        R                  R	                  S[        U5      5        M.     U R                  U R                  5        g )Nrt  r   )rt  ri  ry   rO   insertr_   r&  _unconfigure_python_pathrj  s     rI   _configure_python_pathConfig._configure_python_path$  sD    T[[67DHHOOAs4y) 8667rH   c                    U R                  S5       HC  n[        U5      nU[        R                  ;   d  M$  [        R                  R	                  U5        ME     g )Nrt  )ri  r_   ry   rO   remove)rQ   rO   path_strs      rI   r  Config._unconfigure_python_path*  s:    KK-D4yH388#) .rH   c                    X R                   l         U R                   R                  U[        R                  " U R                  5      S9  U R                   ?U$ ! U R                   ?f = f)zValidate known args.rn  )r  _config_source_hintrw  rx  r  )rQ   r   vias      rI   _validate_argsConfig._validate_args0  sY    +.(	1LL55		$++ 6 6  0 0s   8A A&c          
        U(       a  [         R                  R                  nUnX4$ XE:X  a  [         R                  R                  nU(       a  UnOk/ nU H0  n	UR	                  [        [        R                  " U	SS95      5        M2     U(       a)  U(       d"  U(       a  Sn
U R                  [        U
5      SS9  O/ nU(       d&  [         R                  R                  n[        U5      /nUW4$ )zDecide the args (initial paths/nodeids) to use given the relevant inputs.

:param warn: Whether can issue warnings.

:returns: The args and the args source. Guaranteed to be non-empty.
T)	recursivezNo files were found in testpaths; consider removing or adjusting your testpaths configuration. Searching recursively from the current directory instead.r8   
stacklevel)r   r  r  r   extendsortedrp  iglobissue_config_time_warningr.   r  r_   )rQ   r   r\  rd  r`  r^  r>  sourceresultrO   warning_texts              rI   rf  Config._decide_args<  s      &&++FF2 ~/ )**44&FF )fTZZ-M&NO !* !\ )
 !:: 3L Aa ;  **99n-.v~rH   c                   U(       a\  [         R                  R                  SS5      n[        U5      (       a,  U R	                  [
        R                  " U5      S5      U-   US S & U R                  U5        U(       a'  U R	                  U R                  S5      S5      U-   US S & U R                  R                  U[        R                  " U R                  5      S9U l        U R                  5         U R                  U5        U R!                  5         U R"                  R%                  USS9  [         R                  R                  S	5      (       d6  U R                  R&                  (       d  U R"                  R)                  S
5        U R"                  R+                  5         U R                  R                  U[        R                  " U R                  5      S9U l        U R-                  5         U R/                  5         U R                  R0                  cR  U R2                  b   [5        U R2                  R6                  5      nO[5        U R8                  5      nX@R                  l         U R:                  R=                  XU R                  S9  g ! [>         ag  nU R                  R@                  (       d  U R                  RB                  (       a+  U RE                  [G        SURH                   35      SS9   S nAg e S nAff = f)NPYTEST_ADDOPTSr  zvia PYTEST_ADDOPTSrU  zvia addopts configrn  Fr   r  r  )rj  r   r	  z"could not load initial conftests: r7   r  )%rc   rp   rq   r  r  shlexrb   r  ri  r  parse_known_argsrx  r  rg  _checkversionr  r  r   r   r  r  r  _validate_plugins_warn_about_skipped_pluginsr_  r!  r_   r   r^  rs   rk  rK   r8  r6  r  r.   rO   )rQ   r   rU  env_addoptsr_  r   s         rI   	_preparseConfig._preparsei  sc   **..)92>K;''K(@BVW Q 	d##DKK	$:<PQTXX G %)LL$A$ADIIdkk2 %B %
! 	!!$'##%,,T,F

?@@--EE :::F 	'')$(LL$A$ADIId&?&?@ %B %
! 	 ((*$$//7||' !4!45
 /
3=%%0	II33!T\\ 4  % 		((--1J1J1R1R ..'*LQVVH(UV  / 
 		s   &$J 
K<AK76K77K<)wrapperc              #  ^   #     S v U R                  5         $ ! U R                  5         f = f7frN   )_validate_config_optionsrX   s    rI   pytest_collectionConfig.pytest_collection  s%     	,))+D))+s   - -*-c                Z   SS K nU R                  R                  SS 5      nU(       a  SSKJn  [        U[        5      (       d  UR                  U R                   S35      eU" U5      U" UR                  5      :  a.  UR                  U R                   SU SUR                   S35      eg g )Nr   rs  Versionz%: 'minversion' must be a single valuez: 'minversion' requires pytest-z, actual pytest-')
r3   rz  rq   packaging.versionr  r   r_   r   r!  r   )rQ   r3   minverr  s       rI   r  Config._checkversion  s    t41fc**''||n$IJ  v););!<<''||n$CF8K[\b\n\n[oopq  = rH   c                n    [        U R                  5       5       H  nU R                  SU S35        M     g )NzUnknown config option: ro   )r  _get_unknown_ini_keys_warn_or_fail_if_strict)rQ   keys     rI   r  Config._validate_config_options  s2    $4467C((+B3%r)JK 8rH   c                   [        U R                  S5      5      nU(       d  g SSKJn  SSKJn  SSKJn  U R                  R                  5       nU VVs0 s H  u  pgUR                  UR                  _M     nnn/ n	U Hs  n
 U" U
5      nUR                  U;  a  U	R                  U
5        M/  UR                  R                  U" XR                     5      SS9(       a  Mb  U	R                  U
5        Mu     U	(       a)  [        SR!                  S	R#                  U	5      5      5      eg s  snnf ! U a    U	R                  U
5         M  f = f)
Nrv  r   )InvalidRequirement)Requirementr  T)prereleaseszMissing required plugins: {}r   )r  ri  packaging.requirementsr  r  r  r  r   list_plugin_distinfoproject_namer6  r   r   	specifiercontainsr   r   r   )rQ   rv  r  r  r  plugin_infor7  r  plugin_dist_infomissing_pluginsrequired_pluginreqs               rI   r  Config._validate_plugins  s1   !$++.@"AB 	>6-((==?KVW;D--t||;;W/O!/2
 xx//&&7]]++(23 ,    &&7  0 .55dii6PQ  # X & &&7s   #D&D,,EEc                    U R                   R                  (       a  [        U5      eU R                  [	        U5      SS9  g )Nr8   r  )rg  strict_configr   r  r.   )rQ   r  s     rI   r  Config._warn_or_fail_if_strict  s6    $$22W%%&&':7'CPQ&RrH   c                    U R                   R                  nU R                   Vs/ s H  o"U;  d  M
  UPM     sn$ s  snf rN   )r  _inidictrz  )rQ   parser_inicfgr   s      rI   r  Config._get_unknown_ini_keys  s2    --!%JM0IJJJs   	;;c           	        U R                   / :X  d   S5       eU R                  R                  R                  [	        U R
                  S9S9  U R                  XS9  SU R                  l         U R                  R                  XR                  U R                  S9nU R                  UU R                  R                  U R                  S5      U R                  R                   U R"                  SS9u  U l         U l        g ! [&         a     g f = f)	Nz:can only parse cmdline args at most once per Config object)r   r;  rT  Trn  rd  re  )r   rs   pytest_addhooksrA  rB  r   r  r  after_preparseparse_setoptionr  rf  rg  r\  ri  r   r   r^  r  r   )rQ   r   rU  s      rI   r9  Config.parse  s    yyB 	
H	
 			!!//d&8&89 	0 	
 	t-&*#	<<//kkT[[ 0 D +/*;*;0077++k2#5599 +< +'DIt'  		s   -BC> >
D
Dc           	        U R                   R                  S5      (       a  gU R                  R                  =(       d    / nU R	                  S5      n[
        R                  " SS9 n[
        R                  " S[        U5      5        [        XC5        [
        R                  " XS9  SSS5        W(       a  [        R                  " US-
  5      nUR                  R                  UR                  UR                  R                   4nU R"                  R$                  R'                  [)        US	   S
SUS9S9  gg! , (       d  f       N= f)a  Issue and handle a warning during the "configure" stage.

During ``pytest_configure`` we can't capture warnings using the ``catch_warnings_for_item``
function because it is not possible to have hook wrappers around ``pytest_configure``.

This function is mainly intended for plugins that need to issue warnings during
``pytest_configure`` (or similar stages).

:param warning: The warning instance.
:param stacklevel: stacklevel forwarded to warnings.warn.
r   NfilterwarningsT)recordalwaysr  r   r   rj   r  )warning_messagewhenrL  locationr;  )r   r  rg  pythonwarningsri  r   catch_warningssimplefilterrW   apply_warning_filtersr>  ry   	_getframef_codeco_filenamef_linenoco_namers   pytest_warning_recordedrA  rB  )rQ   warningr  cmdline_filtersconfig_filtersrecordsframer  s           rI   r   Config.issue_config_time_warning  s     ((4433BBHb%56$$D1W!!(DM:!.BMM'9 2
 MM*q.1E||//AUAUUHII--;;$+AJ!%	 <   21s   &A D77
Ec                v    U R                  U5      n[        U[        5      (       d   eUR                  U5        g)zAdd a line to an ini-file option. The option must have been
declared but might not yet be set in which case the line becomes
the first line in its value.N)ri  r   r   r   )rQ   r   r{   rq  s       rI   rQ  Config.addinivalue_line+  s0     KK!T""""	rH   c                     U R                   U   $ ! [         a%    U R                  U5      =U R                   U'   nUs $ f = f)a  Return configuration value from an :ref:`ini file <configfiles>`.

If a configuration value is not defined in an
:ref:`ini file <configfiles>`, then the ``default`` value provided while
registering the configuration through
:func:`parser.addini <pytest.Parser.addini>` will be returned.
Please note that you can even provide ``None`` as a valid
default value.

If ``default`` is not provided while registering using
:func:`parser.addini <pytest.Parser.addini>`, then a default value
based on the ``type`` parameter passed to
:func:`parser.addini <pytest.Parser.addini>` will be returned.
The default values based on ``type`` are:
``paths``, ``pathlist``, ``args`` and ``linelist`` : empty list ``[]``
``bool`` : ``False``
``string`` : empty string ``""``
``int`` : ``0``
``float`` : ``0.0``

If neither the ``default`` nor the ``type`` parameter is passed
while registering the configuration through
:func:`parser.addini <pytest.Parser.addini>`, then the configuration
is treated as a string and a default empty string '' is returned.

If the specified name hasn't been registered through a prior
:func:`parser.addini <pytest.Parser.addini>` call (usually from a
plugin), a ValueError is raised.
)r  r  _getini)rQ   r   vals      rI   ri  Config.getini3  sF    <	>>$'' 	)-d);;DNN4 3J	s    ,A A c                0    SU SU SU< 3n[        U5      e)NzOption z  has unknown configuration type z with value )rw   )rQ   r   rW   valuer   s        rI   _getini_unknown_typeConfig._getini_unknown_typeY  s*    dV;D6eYW 	 orH   c                    U R                   R                  U   u  p#nU R	                  U5      nUc   U R
                  U   nOUnUS:X  a{  U R                  b  U R                  R                  OU R                  R                  n[        U[        5      (       a  [        R                  " U5      OUn	U	 V
s/ s H  oU
-  PM	     sn
$ US:X  a-  [        U[        5      (       a  [        R                  " U5      $ U$ US:X  aL  [        U[        5      (       a5  [        S UR                  S5      5       Vs/ s H  o(       d  M  UPM     sn$ U$ US:X  a"  [        [        U5      R!                  5       5      $ US:X  a  U$ US	:X  a3  [        U[        5      (       d  [#        S
U SU< 35      S e[%        U5      $ US:X  a3  [        U[        5      (       d  [#        SU SU< 35      S e['        U5      $ Uc  U$ U R)                  XU5      $ ! [         a  n[        SU< 35      UeS nAff = f! [         a    Us $ f = fs  sn
f s  snf )Nzunknown configuration value: ru  r   linelistc                "    U R                  5       $ rN   r  )rq  s    rI   <lambda> Config._getini.<locals>.<lambda>  s
    rH   ro   rL  stringintz"Expected an int string for option z of type integer, but got: floatz#Expected a float string for option z of type float, but got: )r  r  r  rw   _get_override_ini_valuerz  r!  r   r   r   r   r_   r  rb   map
_strtoboolr  r   r  r  r  )rQ   r   descriptionrW   r]  r   override_valuer  dpinput_valuesrq  ts               rI   r	  Config._getini_  sD   	N)-)>)>t)D&Kw 55d;!D) #E  7? <<+ ##++// 
 2<E31G1G5;;u-UL$01LqFL11V^)3E3)?)?5;;u%JUJZ%%%#&':EKK<M#NT#NaRS#NTTV^c%j..011XLU]eS))8>YZ_Ybc u:W_eS))9$?XY^Xab <\L,,T??w  	N<THEFAM	N  4 2
 Us:   H H& 5H82
H= H=
H#HH#&H54H5c                    U R                   R                  X5      u  p4UR                  c   e[        R
                  " UR                  5      R                  n/ nU Hw  n[        U[        R                  5      (       a  [        R
                  " U5      nO-UR                  S[        R                  5      n[        XW-  5      nUR                  U5        My     U$ ! [         a     g f = f)Nr  )r   r  r  r  r   r   r   r   rc   r   r?  rd   r'   r   )rQ   r   rO   ry  relrootsmodpathvaluesrelroots           rI   _getconftest_pathlistConfig._getconftest_pathlist  s    	 ..AA$MMC ||''',,s||,33%'G'2;;//!,,w/!//#rvv6&w'89MM'"     		s   C 
C&%C&c                    S nU R                    H!  n UR                  SS5      u  pEXA:X  a  UnM!  M#     U$ ! [         a  n[        SU< S35      UeS nAff = f)Nr   r   z3-o/--override-ini expects option=value style (got: z).)r  rb   rw   r   )rQ   r   r  
ini_configr  user_ini_valuer   s          rI   r  Config._get_override_ini_value  sz     ,,J+&0&6&6sA&># ;*E  -    I*WYZs   6
A AAFc                :   U R                   R                  X5      n [        U R                  U5      nUc  U(       a  [	        U5      eU$ ! [         aF  nU[
        La  Us SnA$ U(       a  SSKnUR                  SU< S35        [        SU< 35      UeSnAff = f)a;  Return command line option value.

:param name: Name of the option. You may also specify
    the literal ``--OPT`` option instead of the "dest" option name.
:param default: Fallback value if no option of that name is **declared** via :hook:`pytest_addoption`.
    Note this parameter will be ignored when the option is **declared** even if the option's value is ``None``.
:param skip: If ``True``, raise :func:`pytest.skip` if option is undeclared or has a ``None`` value.
    Note that even if ``True``, if a default was specified it will be returned instead of a skip.
Nr   zno z option foundzno option named )	r  rq   r   r  r   notsetr3   skiprw   )rQ   r   r]  r/  r
  r   r3   s          rI   	getoptionConfig.getoption  s     ~~!!$-	A$++t,C{t$T**J 	Af$c$78/x89q@	As#   ,A
 

B
BB$1BBc                $    U R                  U5      $ )z$Deprecated, use getoption() instead.r0  rQ   r   rO   s      rI   getvalueConfig.getvalue  s    ~~d##rH   c                "    U R                  USS9$ )z-Deprecated, use getoption(skip=True) instead.T)r/  r3  r4  s      rI   getvalueorskipConfig.getvalueorskip  s    ~~d~..rH   
assertionsr   VERBOSITY_ASSERTIONS
test_casesVERBOSITY_TEST_CASESr  _VERBOSITY_INI_DEFAULTc                   U R                  SSS9n[        U[        5      (       d   eUc  U$ [        R	                  U5      nX0R
                  R                  ;  a  U$ U R                  U5      nU[        R                  :X  a  U$ [        U5      $ )a  Retrieve the verbosity level for a fine-grained verbosity type.

:param verbosity_type: Verbosity type to get level for. If a level is
    configured for the given type, that value will be returned. If the
    given type is not a known verbosity type, the global verbosity
    level will be returned. If the given type is None (default), the
    global verbosity level will be returned.

To configure a level for a fine-grained verbosity type, the
configuration file should have a setting for the configuration name
and a numeric value for the verbosity level. A special value of "auto"
can be used to explicitly use the global verbosity level.

Example:

.. code-block:: ini

    # content of pytest.ini
    [pytest]
    verbosity_assertions = 2

.. code-block:: console

    pytest -v

.. code-block:: python

    print(config.get_verbosity())  # 1
    print(config.get_verbosity(Config.VERBOSITY_ASSERTIONS))  # 2
verboser   )r]  )	r0  r   r  r   _verbosity_ini_namer  r  ri  r>  )rQ   verbosity_typeglobal_levelini_namelevels        rI   get_verbosityConfig.get_verbosity  s    > ~~i~;,,,,,!--n=<<000H%F1115zrH   c                    SU  3$ )N
verbosity_r;   )rB  s    rI   rA  Config._verbosity_ini_name  s    N+,,rH   c                j    U R                  [        R                  U5      US[        R                  S9  g)as  Add a output verbosity configuration option for the given output type.

:param parser: Parser for command line arguments and ini-file values.
:param verbosity_type: Fine-grained verbosity category.
:param help: Description of the output this type controls.

The value should be retrieved via a call to
:py:func:`config.get_verbosity(type) <pytest.Config.get_verbosity>`.
r  )r8  rW   r]  N)r|  r   rA  r>  )r	  rB  r8  s      rI   _add_verbosity_iniConfig._add_verbosity_ini  s2     	&&~611	 	 	
rH   c                l    [        5       (       d%  US:X  a  SnOSnU R                  [        U5      SS9  g g )Nr  zRASSERTIONS ARE NOT EXECUTED and FAILING TESTS WILL PASS.  Are you using python -O?zassertions not in test modules or plugins will be ignored because assert statements are not executed by the underlying Python interpreter (are you using python -O?)
r8   r  )_assertion_supportedr  r.   )rQ   r  r  s      rI   r  $Config._warn_about_missing_assertion.  sK    #%%w( 3  **#L1 +  &rH   c           	         U R                   R                   H%  u  pU R                  [        SU< SU 35      SS9  M'     g )Nzskipped plugin rU   r7   r  )r   r  r  r.   )rQ   r  r   s      rI   r  "Config._warn_about_skipped_pluginsC  sG     $ 2 2 B BK**#ok_Bse$LM +  !CrH   )r  r  r  r   r  r  r  r  r  r   r  rs   rz  r   rg  r  r   r  r  )r   r   r   zInvocationParams | Noner]   r^   )r]   r[   )r]   r  )r%  zCallable[[], None]r]   r^   r  )r]   r!   )r   r   r   	list[str]r]   r   rN   )rE  zExceptionInfo[BaseException]r  zargparse.Namespace | Noner]   r^   )rL  r_   r]   r_   )r]   r   )r  r"   r]   r^   )rj  r   r]   r^   )r   r  r]   r^   )rs   r0   r  rL  r]   r^   )r   rS  r  r_   r]   rS  )r   rS  r\  rL  rd  rS  r`  r[   r^  r[   r>  rL  r]   ztuple[list[str], ArgsSource])T)r   rS  rU  rL  r]   r^   )r]   zGenerator[None, object, object])r  r_   r]   r^   )r]   rS  )r   Warningr  r  r]   r^   )r   r_   r{   r_   r]   r^   )r   r_   r]   r   )r   r_   rW   r_   r  r  r  )r   r_   rO   r[   r]   zlist[pathlib.Path] | None)r   r_   r]   r  )r   r_   r]  r   r/  rL  )rB  r  r]   r  )rB  r_   r]   r_   )r	  r$   rB  r_   r8  r_   r]   r^   )r  r_   r]   r^   )Ar<   r=   r>   r?   r@   r   dataclasses	dataclassr   r  Enumr  r  rR   propertyr^  r!  r&  r)  ru   r3  r   rI  rQ  classmethodrZ  r  hookimplrk  r  r  r  r  r  r  rf  r  r  r  r  r  r  r  r9  r  rQ  ri  r  r	  r'  r  r.  r0  r5  r8  r;  r=  r>  rF  r   rA  rL  r  r  rG   r;   rH   rI   r   r     s    $'1 1 ( 1B TYY   L 6:	;"*;" 3	;"
 
;"z    +K
=$08A	8 -1#-# *# 
	#$	  < d
 
43810$*$>B$	$.8*
+ + 	+
 + %+ + + 
&+Z:x d, ,$LBSK2!F"L>@@+	"&" 39u A2$/
 #/%.".%.$*E*,\ - - 
 
"*rH   c                 (      e! [          a     gf = f)NT)r  r;   rH   rI   rO  rO  K  s    u s    
c                &   [        US9nU R                  R                  S:X  a  SUl        O!U R                  R                  S:X  a  SUl        U R                  R                  S:X  a	  SUl        U$ U R                  R                  S:X  a  SUl        U$ )zCreate a TerminalWriter instance configured according to the options
in the config object.

Every code which requires a TerminalWriter object and has access to a
config object should use this function.
)r  yesTnoF)r!   r  color	hasmarkupcode_highlight)rj   r  r   s      rI   create_terminal_writerrb  T  s     
T	"B}}e#				$}}##u,  I 
	%	%	-!IrH   c                \    U R                  5       n U S;   a  gU S;   a  g[        SU < 35      e)a  Convert a string representation of truth to True or False.

True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'.  Raises ValueError if
'val' is anything else.

.. note:: Copied from distutils.util.
)yr]  r   trueon1T)r  r^  ffalseoff0Fzinvalid truth value )lowerrw   )r
  s    rI   r  r  l  s:     ))+C
22	5	5/w788rH   2   )maxsizec          	        Sn[        SU  S35      nU R                  S5      n[        U5      S:  a5  Sn[        S[        U5       SU S	35      n[        UR	                  US
95      e[        U5      S:  a"  UR                  S5        [        U5      S:  a  M"  S U 5       u  pxpn [        R                  " U5      n [        U	5      nU(       a  U(       a  [        R                   " U5      nU
(       a   U(       a  [        R                   " U
5      S-   n
U(       a   [#        U5      nUS:  a  [%        S5      eOSn [        R&                  " U5        [        R&                  " U
5        XXU4$ ! [        R                   a'  n[        UR	                  [        U5      S
95      SeSnAff = f! [         a>    [        R                  " 5       nUR                  SS9n[        UR	                  US
95      Sef = f! [$         a%  n[        UR	                  SU< SU 3S
95      SeSnAff = f! [        R(                   a/  n[        UR	                  SUR*                  < SU 3S
95      SeSnAff = f)zParse a warnings filter string.

This is copied from warnings._setoption with the following changes:

* Does not apply the filter.
* Escaping is optional.
* Raises UsageError so we get nice error messages on failure.
TzF        while parsing the following warning configuration:

          z8

        This error occurred:

        {error}
        :r:   zJhttps://docs.python.org/3/library/warnings.html#describing-warning-filtersz            Too many fields (z), expected at most 5 separated by colons:

              action:message:category:module:line

            For more information please consult: z
            )errorr  c              3  @   #    U  H  oR                  5       v   M     g 7frN   r  )r  ss     rI   r  'parse_warning_filter.<locals>.<genexpr>  s     3Mu!GGIIus   NrA  )rm   z\Zr   znumber is negativezinvalid lineno rU   zInvalid regex )r
   rb   r  r   r   r   r   
_getaction_OptionErrorr_   _resolve_warning_categoryr\   r   from_currentr~   reescaper  rw   compilerq  pattern)r  rz  __tracebackhide__error_templater  doc_urlrq  action_r  	category_modulelineno_actionr   categoryr   exception_textlinenos                     rI   parse_warning_filterr  ~  s     % 		
N IIcNE
5zA~X 	 !%j\ *2 3: ;
 ..U.;<<
e*q.R e*q.3Mu3M0GiH'/':':7'CP";I"F
 6))G$&6"U*	\Fz !566  


7


6
 Hf44=    H..SV.<=4GH  P --/!)))9..^.DE4OP  	%%og[1#,N%O	 88 !!.Rs(K!L
	sU   &E, =F* G5 ;,H' ,F' "F""F'*AG25
H$? HH$'I*;*I%%I*c                
   SnU (       d  [         $ SU ;  a  SSKnU nO#U R                  S5      u  pEn[        USSU/5      n[	        X#5      n[        U[         5      (       d  [        U S35      e[        [        [            U5      $ )z
Copied from warnings._getcategory, but changed so it lets exceptions (specially ImportErrors)
propagate so we can get access to their tracebacks (#9218).
T.r   Nz is not a Warning subclass)	rT  builtins
rpartitionr  r   
issubclassr   r   rW   )r  r}  r   klassr  r7  cats          rI   rw  rw    s    
 
(#..s35vtTE73
!
Cc7##C5 :;<<Ws##rH   c                    U  H  n[         R                  " [        USS96   M      U H  n[         R                  " [        USS96   M      g)z8Applies pytest-configured filters to the warnings moduleF)rz  TN)r   r  r  )r  r  r  s      rI   r  r    sF     !5c%!HI  !5c$!GH rH   )re   z_pytest._code.TracebackEntryr]   rL  )NN)r   #list[str] | os.PathLike[str] | Noner   r  r]   zint | ExitCode)r]   r  )rO   r_   r   r_   r]   r_   )r   zlist[str] | Noner   r  r]   r   )r]   r   )r   r  r   r  r]   r   )rO   r[   r]   r[   )r   r   r   r_   r   r  r]   zdict[str, bool])r  r  r]   rS  )r  r  r]   zIterator[str])r]   rL  rN   )rj   r   r  zTextIO | Noner]   r!   )r
  r_   r]   rL  )r  r_   rz  rL  r]   z9tuple[warnings._ActionKind, str, type[Warning], str, int])r  r_   r]   ztype[Warning])r  r  r  r  r]   r^   )yr@   
__future__r   r  collections.abcr  r   r   r   r   r   r  rx  rU  r  	functoolsr	   rp  importlib.metadatara   r   rc   r   ry  r  ry   textwrapr
   rC  r   typingr   r   r   r   r   r   r   r   pluggyr   r   r   r   r   compatr   
exceptionsr   r   	findpathsr   r   r   _pytest._coder   r   _pytest._code.coder    _pytest._ior!   _pytest.config.argparsingr"   r$   _pytest.deprecated_pytest.hookspec_pytest.outcomesr%   r&   _pytest.pathlibr'   r(   r)   r*   r+   r,   _pytest.stashr-   _pytest.warning_typesr.   r/   _pytest.assertion.rewriter0   _pytest.cacheproviderr1   _pytest.terminalr2   r  r  rZ  r  IntEnumr5   r\   rK   rf   r   r   r   r   r   r  r   r  r   r   rr   r   r  r   r  r  r.  r  r   rO  rb  r  r  rw  r  r;   rH   rI   <module>r     s    @ "   $ % $ $ $         	  	  
              !  !    & . 0 &   ' * - & . ,   ! $ ( ' ' & 0 '  5 3 @+1 (#(# t||  ,OI OX'X	X 15484>
-4>14> 4>n$    	
             !" #$ %& '( )* +, -. /0 12 34 5:  "48
1 2& 1548
-1 @  	@ ^(- ^( ^(B8* 
 
>CB @ @ @F +/'09$ 2K5	K5K5>K5 K5\$,
I!
I4A
I	
IrH   