
    ?g                      S 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	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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S0KQJRrR  SS1KSJTrT  \UrV \(" S25      rW\*" S25      rX\ " S3 S4\R                  5      5       rZ " S5 S6\[5      r\    SpS7 jr]  Sq     SrS8 jjr^SsS9 jr_ " S: S;5      r`StS< jraStS= jrbS>rc/ \cQ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SXP7rd\e" \d5      rf\fR                  SY5        \fR                  SZ5          Sq     SuS\ jjrhSvS^ jri  Sq     SwS_ jjrjSxS` jrk        SySa jrl\ " Sb S]\,5      5       rm    SzSc jrn " Sd Se5      ro\o" 5       rpS{Sf jrq\ " Sg S[5      5       rrS|Sh jrs S}     S~Si jjrtSSj jru\
" SkSl9      SSm j5       rvSSn jrw      SSo jrxg)z:Command line options, ini-file and conftest.py processing.    )annotationsN)	lru_cache)dedent)FunctionType)Any)Callable)cast)Final)final)	Generator)IO)Iterable)Iterator)Sequence)TextIO)Type)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)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;       9/usr/lib/python3/dist-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warningsloggingreportspython_pathunraisableexceptionthreadexception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   3  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>   r0   r	   r   )method	hook_type	opt_namesmknown_marks	must_warnoptsopt_nameopt_attrr   messages              rI   _get_legacy_hook_marksr  f  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 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                  UR                  5        U R                  U 5        [        R                  R!                  S5      (       a  ["        R$                  n['        USS5      n [)        [        R*                  " UR-                  5       5      UR.                  SUS	9nU R2                  R4                  R7                  UR8                  5        U R;                  5         UR<                  R?                  5       U l         SU l!        g ! [0         a     Nrf = f)
Nr   r3   F   PYTEST_DEBUGencodingutf8r   )mode	bufferingr	  )"_pytest.assertionsuperrR   set_conftest_plugins_dirpath2confmods_confcutdir_noconftestr   r   skipped_pluginsadd_hookspecshookspecr   rc   rp   rq   ry   rz   r   r   dupr   r  r\   traceroot	setwriterwriteenable_tracingr   DummyRewriteHookrewrite_hook_configured)rQ   r   errr	  	__class__s       rI   rR   PytestPluginManager.__init__  s-    " 9< NP04 
 (n^< 797++,d::>>.))::C#CV<HFF3::<(%	 JJOO%%cii0! $-->>@   s   8E& &
E32E3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      $ ):meta private:pytest_Npytest_pluginsimpl)tryfirsttrylastoptionalhookhookwrapper)
startswithr  parse_hookimpl_optsr   r   r   r  )rQ   r   r   r   r   r!  s        rI   r-  'PytestPluginManager.parse_hookimpl_opts  sp     y))##w*68K&  ((%FR
 	
rH   c                   > [         TU ]  X5      nUc.  [        X5      nUR                  S5      (       a  [	        USS5      nU$ )r$  r%  r   )firstresulthistoric)r  parse_hookspec_optsr   r,  r  )rQ   module_or_classr   r   r   r!  s        rI   r2  'PytestPluginManager.parse_hookspec_opts  sJ    w*?A<_3Fy))-/
 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   r8  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.)boolrG  )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
importmoderW  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_confcutdirT  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 )NrV  ztest*)_loadconftestmodulesis_dirglob)rQ   rd  r`  r]  rW  xs         rI   rZ  &PytestPluginManager._try_load_conftestc  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.pyrV  )	r  r   r  reversedrh  ri  r   _importconftestr   )
rQ   rO   r`  r]  rW  	directoryclistr   conftestpathmods
             rI   rl  (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   rt  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   )rz  rr  r   r   KeyError)rQ   r   rO   modulesrw  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  rW  )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_   rG  r	   rB  rC  r,   ry   r~  stemr}  r*   r\   __traceback__rK   _check_non_top_pytest_pluginsr  addr   r  itemsrh  AssertionError__file__r   r  consider_conftest)rQ   rv  r`  r]  rW  conftestpath_plugin_nameexistingpkgpathrw  r   dirpathrO   modss                rI   rs  #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  rX  r&   r   r  )rQ   rw  rv  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   rc  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_env2  s    !!"**..1A"BCrH   c                <    U R                  [        US/ 5      5        g)r$  r&  N)r  r   )rQ   rw  s     rI   rD  #PytestPluginManager.consider_module6  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_blockedrG  builtin_pluginsr  mark_rewriteload_setuptools_entrypoints
__import__ry   r~  r   ImportErrorr   with_tracebackr  r'   r  r   r   )rQ   modnamer  
importspecloadedrw  r   s          rI   r   !PytestPluginManager.import_pluginA  s5    S
 
 	</{;	< 
 ??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  rX  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]   rK  )rj   r   r]   r^   )r   zSequence[str | pathlib.Path]r[  rK  r\  rK  r]  r[   r^  pathlib.Path | Noner_  r[   r`  zImportMode | strrW  rK  r]   r^   )rO   r[   r]   rK  )
rd  r[   r`  str | ImportModer]  r[   rW  rK  r]   r^   )
rO   r[   r`  r  r]  r[   rW  rK  r]   r^   )rO   r[   r]   zSequence[types.ModuleType])r   r_   rO   r[   r]   ztuple[types.ModuleType, Any])
rv  r[   r`  r  r]  r[   rW  rK  r]   types.ModuleType)rw  r  rv  r[   r]   r^   )r   Sequence[str]r   rK  r]   r^   )r  r_   r]   r^   )r  r  r  r_   r]   r^   )rw  r  r]   r^   )r   -None | types.ModuleType | str | Sequence[str]r]   r^   )F)r  r_   r  rK  r]   r^   )r<   r=   r>   r?   r@   rR   r-  r2  r   rH  rL  rQ  re  ri  rZ  rl  rz  r  rs  r  r   r   r  r  rD  r  r   rG   __classcell__)r!  s   @rI   r   r     s	   1!f
#
+.
	
4 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   rB  rC  r_   rb   collectionsabcr   r   r   )specss    rI   r  r  g  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_namer6  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.     SAS jjr\SBS j5       r\SCS j5       rSDS jrSES jrSES jrSFS jr      SGS jr SH     SIS jjrSJS jr\SKS j5       rSLS jr\" SS9SMS j5       rSNS jrSNS jrSES jrSOS jr               SPS jr!SQSRS  jjr"\" SS!9SSS" j5       r#SES# jr$SES$ jr%SES% jr&STS& jr'SUS' jr(SQSRS( jjr)SVS) jr*SWS* jr+SXS+ jr,SYS, jr-SXS- jr.      SZS. jr/S[S/ jr0\1S04S\S1 jjr2SHSXS2 jjr3SHSXS3 jjr4S4r5S5\S6'   S7r6S5\S8'   S9r7S5\S:'   SHS]S; jjr8\9S^S< j5       r:\9S_S= j5       r;S`S> jr<SES? jr=S@r>g)ar   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               H   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        / U l        U R                  R5                  U S5        SU l        U R*                  R8                  R;                  [=        U R                  U R                  S9S9  [>        R@                  RB                  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_cleanupr   r  pytest_addoptionr@  rA  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	)+,.)+24##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.rootpathB  s     ~~rH   c                    U R                   $ )zHThe path to the :ref:`configfile <configfiles>`.

.. versionadded:: 6.1
)_inipathrX   s    rI   inipathConfig.inipathL  s     }}rH   c                :    U R                   R                  U5        g)zpAdd a function to be called when the config object gets out of
use (usually coinciding with pytest_unconfigure).N)r  r   )rQ   funcs     rI   add_cleanupConfig.add_cleanupT  s     	T"rH   c                   U R                   (       a   eSU l         [        R                  " 5          [        R                  " S5        U R                  R
                  R                  [        U S9S9  S S S 5        g ! , (       d  f       g = f)NTdefaultri   r:  )r  r   catch_warningssimplefilterrs   rQ  r@  rA  rX   s    rI   _do_configureConfig._do_configureY  s_    ####$$&!!),II&&44D<M4N '&&s   AA::
Bc                (   U R                   (       a;  SU l         U R                  R                  U S9  / U R                  R                  l        U R
                  (       a5  U R
                  R                  5       nU" 5         U R
                  (       a  M4  g g )NFri   )r  rs   pytest_unconfigurerQ  _call_historyr  rv   )rQ   fins     rI   ru   Config._ensure_unconfigure`  sc    $DII(((579DII&&4mm--##%CE mmmrH   c                Z    U R                   R                  S5      nUc   eUR                  $ )Nterminalreporter)r   rG  _tw)rQ   r/  s     rI   get_terminal_writerConfig.get_terminal_writeri  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.helpconfigr5  r  
_getparser
print_helpry   r   r  )rQ   r   r   r5  s       rI   r   Config.pytest_cmdline_parsep  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)funcargsr@  rm   )excreprexcinforo   zINTERNALERROR> )r   r~   rs   pytest_internalerroranyr_   rb   ry   rz   r  r   )rQ   rC  r  rm   rB  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$ )NrT  )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__updater7  r   r   r   )clsoption_dictr   rj   ro  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 )Nr$  )_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[  ra  r_  r]  r=  rW  )r   r[  r\  r]  r^  r_  r`  rW  )_decide_argsknown_args_namespacefile_or_dirr[  getinir   r   r]  r   re  r\  r^  r`  )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$                  =(       d    SU l        g )N	namespace)inifiler   rootdir_cmd_argr_  rootdirrm  rS  zExtra command line optionsr   
minversionz!Minimally required pytest versionrequired_pluginsz.Plugins that must be present for pytest to run)rW   r$  r;   )r  parse_known_and_unknown_argscopyr  r   inifilenamere  ro  r   r   r  r  inicfgr_   r]  
extra_infor  addinioverride_inir  )rQ   r   nsunknown_argsr]  r  ru  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<	 	 	
  __2rH   c                   U R                   R                  U5      u  p#[        USS5      nUS:X  a1  SSKn UR                  R                  U 5      nU R                  U5        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rewriter   N)	r  rr  r   r  r   install_importhook_mark_plugins_for_rewriteSystemError_warn_about_missing_assertion)rQ   r   ry  rz  r  r   rs   s          rI   _consider_importhookConfig._consider_importhook  s      <<DDTJr<19$5((;;DA ..t4**40	  s   A4 4BBc                    XR                   l        [        R                  R	                  S5      (       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.PYTEST_DISABLE_PLUGIN_AUTOLOADNc              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)rE  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  rc   rp   rq   ra   metadatadistributionsr  r  )rQ   rs   r  r   s       rI   r   Config._mark_plugins_for_rewrite   sf     +/'::>>:;; 
!**88:
 -];Dd# <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.rk  )r  _config_source_hintrr  rs  r  )rQ   r   vias      rI   _validate_argsConfig._validate_args  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sortedrn  iglobissue_config_time_warningr/   r  r_   )rQ   r   r[  ra  r_  r]  r=  sourceresultrO   warning_texts              rI   rc  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                   R#                  USS9  [         R                  R                  S	5      (       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                  R,                  cR  U R.                  b   [1        U R.                  R2                  5      nO[1        U R4                  5      nX@R                  l         U R6                  R9                  XU R                  S9  g ! [:         ag  nU R                  R<                  (       d  U R                  R>                  (       a+  U RA                  [C        SURD                   35      SS9   S nAg e S nAff = f)NPYTEST_ADDOPTSr  zvia PYTEST_ADDOPTSrS  zvia addopts configrk  Fr   r  r  )rg  r   r  z"could not load initial conftests: r7   r  )#rc   rp   rq   r  r  shlexrb   r{  rf  r  parse_known_argsrs  r  rd  _checkversionr  r   r   r  r  _validate_plugins_warn_about_skipped_pluginsr^  r  r_   r   r]  rs   rh  rK   r6  r4  r  r/   rO   )rQ   r   rS  env_addoptsr^  r   s         rI   	_preparseConfig._preparseN  sF   **..)92>K;''K(@BVW Q 	d##DKK	$:<PQTXX G %)LL$A$ADIIdkk2 %B %
! 	!!$',,T,Fzz~~>?? :::F'')$(LL$A$ADIId&?&?@ %B %
! 	 ((*$$//7||' !4!45
 /
3=%%0	II33!T\\ 4  % 		((--1J1J1R1R ..'*LQVVH(UV  / 
 		s   ;$I   
K*AKK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   rp  Versionz%: 'minversion' must be a single valuez: 'minversion' requires pytest-z, actual pytest-')
r3   ru  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)
Nrq  r   )InvalidRequirement)Requirementr  T)prereleaseszMissing required plugins: {}r   )r  rf  packaging.requirementsr  r  r  r  r   list_plugin_distinfoproject_namer4  r   r   	specifiercontainsr   r   r   )rQ   rq  r  r  r  plugin_infor6  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  )rd  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  _inidictru  )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:  rR  Trk  ra  rb  )r   rs   pytest_addhooksr@  rA  r   r  r  after_preparseparse_setoptionr  rc  rd  r[  rf  r   r   r]  r  r   )rQ   r   rS  s      rI   r7  Config.parse  s     IIO	HG	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whenrJ  locationr:  )r   r  rd  pythonwarningsrf  r   r%  r&  rW   apply_warning_filtersr=  ry   	_getframef_codeco_filenamef_linenoco_namers   pytest_warning_recordedr@  rA  )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)rf  r   r   r   )rQ   r   r{   ro  s       rI   rP  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 ``""``

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   rf  Config.getini  sF    8	>>$'' 	)-d);;DNN4 3J	s    ,A A c                "    SU 3n[        XC5      e)Nzunknown configuration type: )rw   )rQ   r   rW   valuer   s        rI   _getini_unknown_typeConfig._getini_unknown_type6  s    ,TF3$$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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: pathsr   linelistc                "    U R                  5       $ rN   r  )ro  s    rI   <lambda> Config._getini.<locals>.<lambda>b  s
    rH   ro   rK  string)r  r  r}  rw   _get_override_ini_valueru  r  r   r   r   r   r_   r  rb   map
_strtoboolr  r  )rQ   r   descriptionrW   r$  r   override_valuer  dpinput_valuesro  ts               rI   r  Config._getini:  s   	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\L,,T??_  	N<THEFAM	N  4 2
 Us:   F F4 5G2
G G
F1F,,F14GG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   rw  relrootsmodpathvaluesrelroots           rI   _getconftest_pathlistConfig._getconftest_pathlistn  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.r  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  r   r!  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$  )	r  r   intr   _verbosity_ini_namer  r  rf  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;   )r0  s    rI   r/  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  )r6  rW   r$  N)rw  r   r/  r+  )r  r0  r6  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_plugins  sG     $ 2 2 B BK**#ok_Bse$LM +  !CrH   )r  r  r  r  r  r  r  r  r  r   r  rs   ru  r   rd  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   )rC  zExceptionInfo[BaseException]r  zargparse.Namespace | Noner]   r^   )rJ  r_   r]   r_   )r]   r   )r  r#   r]   r^   )rg  r   r]   r^   )r   r  r]   r^   )r   rA  r  r_   r]   rA  )r   rA  r[  rK  ra  rA  r_  r[   r]  r[   r=  rK  r]   ztuple[list[str], ArgsSource])T)r   rA  rS  rK  r]   r^   )r]   zGenerator[None, object, object])r  r_   r]   r^   )r]   rA  )r  Warningr  r.  r]   r^   )r   r_   r{   r_   r]   r^   r  )r   r_   rW   r_   r  zstr | list[str])r   r_   rO   r[   r]   zlist[pathlib.Path] | None)r   r_   r]   r  )r   r_   r  rK  )r0  r  r]   r.  )r0  r_   r]   r_   )r  r%   r0  r_   r6  r_   r]   r^   )r  r_   r]   r^   )?r<   r=   r>   r?   r@   r   dataclasses	dataclassr   r  Enumr  r  rR   propertyr]  r  r!  r'  ru   r1  r   rG  rO  classmethodrX  r  hookimplrh  r{  r  r  r  rc  r  r  r  r  r  r  r  r7  r  rP  rf  r  r  r  r  r  r  r"  r%  r(  r*  r+  r4  r   r/  r:  r  r  rG   r;   rH   rI   r   r     s{    $'1 1 ( 1B TYY   L 6:	;"*;" 3	;"
 
;"z    #
O$08A	8 -1#-# *# 
	#$	  < d
 
4321($*
+ + 	+
 + %+ + + 
&+Z4l d, ,$LBSK2!F H%2@h+	"&" ,2 A2$/
 #/%.".%.$*E*,\ - - 
 
"*rH   c                 (      e! [          a     gf = f)NT)r  r;   rH   rI   r=  r=    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_writerrP  #  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.
)yrK  r  trueon1T)r  rL  ffalseoff0Fzinvalid truth value )lowerrw   )r  s    rI   r  r  ;  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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)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>x  s     3Mu!GGIIus   Nr?  )rm   z\Zr   znumber is negativezinvalid lineno rU   )r   rb   r  r   r   r   r   
_getaction_OptionErrorr_   _resolve_warning_categoryr\   r   from_currentr~   reescaper.  rw   )r  rh  __tracebackhide__error_templater  doc_urlr_  action_r  	category_modulelineno_actionr   categoryr   exception_textlinenos                     rI   parse_warning_filterrt  M  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  Hf44/    H..SV.<=4GH  P --/!)))9..^.DE4OP  	%%og[1#,N%O	s=   &D? =E= G ?E:"E55E:=AG
G7 G22G7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)	rB  builtins
rpartitionr  r   
issubclassr   r	   r   )rq  ri  r   klassrn  r6  cats          rI   re  re    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)rh  TN)r   r  rt  )r  r  r  s      rI   r  r    sF     !5c%!HI  !5c$!GH rH   )re   z_pytest._code.TracebackEntryr]   rK  )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]   rA  )r  r  r]   zIterator[str])r]   rK  rN   )rj   r   r  zTextIO | Noner]   r"   )r  r_   r]   rK  )r  r_   rh  rK  r]   z9tuple[warnings._ActionKind, str, type[Warning], str, int])rq  r_   r]   ztype[Warning])r  r  r  r  r]   r^   )yr@   
__future__r   r	  collections.abcr  rs  rC  r  	functoolsr   rn  importlib.metadatara   r   rc   r   rg  r  ry   textwrapr   rB  r   typingr   r   r	   r
   r   r   r   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/   r0   _pytest.cacheproviderr1   _pytest.terminalr2   r  r  rH  r  IntEnumr5   r\   rK   rf   r   r   r   r   r   r  r   r  r  r  r   r   rr   r   r  r   r  r  r  r  r   r=  rP  r  rt  re  r  r;   rH   rI   <module>r     s1   @ "          	  	  
                    !  !    & . 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6 7< o&   J    ) * "48
1 2& 1548
-1 @  	@ ](- ]( ](@8* 
 
>CB Q Q Qh +/'09$ 2D5	D5D5>D5 D5N$,
I!
I4A
I	
IrH   