
    yIf                    :   d Z ddlZddlZddlZddlZddlZddlmZ ddl	Z	ddl
ZddlZddlZddlmZ ddlZddlZddlZddlmZ ddlZddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ddlm'Z' ddlm(Z( ddlm)Z) ddlm*Z* ddl+Z+ddl,Z,ddl,m-Z- ddl,m.Z. ddl,m/Z/ ddl,m0Z0 ddl,m1Z1 dd l2m3Z3 dd!l4m5Z5 dd"l4m6Z6 dd#l7m8Z8 dd$l9m:Z: ddl;Z9dd%l;m<Z< dd&l;m=Z= dd'l>m?Z? ddl@Z9ddlAZ9dd(lBmCZC dd)lBmDZD dd*lEmFZF dd+lEmGZG dd,lEmHZH dd-lEmIZI dd.lEmJZJ dd/lEmKZK dd0lLmMZM dd1lNmOZO dd2lNmPZP e)rdd3lQmRZR dd4lQmSZS dd5lTmUZU dd6lVmWZW eXZY	  e-d7          ZZ e/d7          Z[e G d8 d9ej\                              Z] G d: d;e^          Z_d<e9j`        ja        d=ebfd>Zc	 	 dd?e#e*e"ed         d@f                  dAe#e$e*edeYf                           d=e*eee]f         fdBZfd=eefdCZg G dD dE          ZhdFeddGedd=edfdHZidFeddGedd=edfdIZjdJZkg ekdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcddR Zl emel          Zneno                    de           eno                    df           	 	 dd?e#e"ed                  dAe#e$e*edeYf                           d=dgfdhZpddjZq	 	 dd?e#e*e"ed         d@f                  dAe#e$e*edeYf                           d=dgfdkZrdFed=efdlZsdmedneddoe'eddpf         d=eedebf         fdqZte G dr die1                      Zudse*dejv        ede$ed         f         d=e"ed         fdtZw G du dv          Zx ex            Zydwe ed         d=e!ed         fdxZze G dy dg                      Z{d=ebfdzZ|	 dd{e{d|e#e&         d=e?fd}Z}d~edd=ebfdZ~ ed          deddebd=e'dede(e         edeef         fd            Zdedd=e(e         fdZde ed         de ed         d=dfdZdS )z:Command line options, ini-file and conftest.py processing.    N)	lru_cache)Path)dedent)FunctionType)Any)Callable)cast)Dict)Final)final)	Generator)IO)Iterable)Iterator)List)Optional)Sequence)Set)TextIO)Tuple)Type)TYPE_CHECKING)Union)HookimplMarker)HookimplOpts)HookspecMarker)HookspecOpts)PluginManager   )PathAwareHookProxy)	PrintHelp)
UsageError)determine_setup)__version__)ExceptionInfo)filter_traceback)TerminalWriter)fail)Skipped)absolutepath)bestrelpath)import_path)
ImportMode)resolve_package_path)safe_exists)Stash)PytestConfigWarning)warn_explicit_for)ArgumentParser)_TracebackStyle)TerminalReporterpytestc                   *    e Zd ZdZdZdZdZdZdZdZ	dS )	ExitCodezEncodes 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____doc__OKTESTS_FAILEDINTERRUPTEDINTERNAL_ERRORUSAGE_ERRORNO_TESTS_COLLECTED     K/var/www/piapp/venv/lib/python3.11/site-packages/_pytest/config/__init__.pyr:   r:   ^   s;          
BLKNKrJ   r:   c                   .    e Zd ZdededdfdZdefdZdS )ConftestImportFailurepathcausereturnNc                "    || _         || _        d S N)rN   rO   )selfrN   rO   s      rK   __init__zConftestImportFailure.__init__v   s     	


rJ   c                 Z    t          | j                  j         d| j         d| j         dS )N: z (from ))typerO   r?   rN   rS   s    rK   __str__zConftestImportFailure.__str__   s2    tz""+NNtzNN$)NNNNrJ   )r?   r@   rA   r   	ExceptionrT   strrZ   rI   rJ   rK   rM   rM   u   sf         	
 
   O O O O O O OrJ   rM   entryrP   c                     t          |           o2dt          | j                                      t          j                  vS )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\   rN   splitossep)r]   s    rK   ,filter_traceback_for_conftest_import_failurerc      s6     E""W{#ej//:O:OPRPV:W:W'WWrJ   argszos.PathLike[str]pluginsc                    t           j                            d          }	 t          t           j        d<   	 t	          | |          }	 |j                            |          }	 t          |          |                                 |!t           j        	                    dd           S |t           j        d<   S # t          $ rK |cY |                                 |!t           j        	                    dd           S |t           j        d<   S w xY w# |                                 w xY w# t          $ r?}t          j        |j                  }t          t           j                  }|                    d|j         dd           |j                            t,                    |_        |j        r|                    dd	
          n|                                }t3          |          }	|	                                D ]+}
|                    |
                                d           ,t          j        cY d}~|!t           j        	                    dd           S |t           j        d<   S d}~ww xY w# t:          $ r}t          t           j                  }|j        D ]}|                    d| dd           t          j        cY d}~|!t           j        	                    dd           S |t           j        d<   S d}~ww xY w# |!t           j        	                    dd           n|t           j        d<   w xY w)aL  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: 
)ra   environgetr$   _prepareconfighookpytest_cmdline_mainr:   _ensure_unconfigurepop
ValueErrorrM   r%   from_exceptionrO   r'   sysstderrlinerN   	tracebackfilterrc   getreprexconlyr\   
splitlinesrstriprG   r"   rd   )rd   re   old_pytest_versionri   reteexc_infotwexc_reprformatted_tbrz   msgs               rK   mainr      sp    (899(>'2
#$	-#D'22F$	-,2K,K,K! -L - -#C== **,,, %JNN+T2222+=BJ'(( "   JJ**,,, %JNN+T2222+=BJ'(( **,,,,5 % 	( 	( 	($3AG<<H
++BGGE16EEE4GPPP!)!3!:!:<" "H
 %(  we <<<%%'' 
 x==L$//11 1 140000''''''$ %JNN+T2222+=BJ'((I	(6  $ $ $CJ''6 	1 	1CGG%c%%%4G0000######%JNN+T2222+=BJ'(($ %JNN+T2222+=BJ'(====s   I6 D) D #B8 1I6 8DD I6 DD D&&I6 )I34DI.6I37I6 .I33I6 6
L A	L	L
L	 LL	 	4L=c                  6   	 t                      } t          j                                         | S # t          $ r^ t          j        t
          j        t
          j                  }t          j	        |t          j        
                                           Y dS w xY w)zoThe CLI entry point of pytest.

    This function is not meant for programmable use; use `main()` instead.
    r   )r   rx   stdoutflushBrokenPipeErrorra   opendevnullO_WRONLYdup2fileno)coder   s     rK   console_mainr      s    	vv
    '"*bk22
**,,---qqs   -0 A$BBc                   $    e Zd Z ee          ZdS )cmdlineN)r?   r@   rA   staticmethodr   rI   rJ   rK   r   r      s        <DDDrJ   r   rN   optnamec                 l    t           j                            |           rt          | d|            | S )ztArgparse type validator for filename arguments.

    :path: Path of filename.
    :optname: Name of the option.
    z must be a filename, given: ra   rN   isdirr"   rN   r   s     rK   filename_argr      s<     
w}}T IGGGGGHHHKrJ   c                 l    t           j                            |           st          | d|            | S )zvArgparse type validator for directory arguments.

    :path: Path of directory.
    :optname: Name of the option.
    z must be a directory, given: r   r   s     rK   directory_argr      s<     7== JGHH$HHIIIKrJ   )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           	         t                      }t          |t                              | pd|t          j                                        }| |                    | d           t          D ]}|                    |           |S )NrI   rd   re   dirinvocation_paramsTexclude_only)PytestPluginManagerr   InvocationParamsr   cwdconsider_preparsedefault_pluginsimport_plugin)rd   re   pluginmanagerri   specs        rK   
get_configr     s    
 ())M 11

 2 
 
  F ''4'@@@ * *##D))))MrJ   r   c                  (    t                      j        S )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   rI   rJ   rK   get_plugin_managerr   8  s     <<%%rJ   c                 ^   | t           j        dd          } nwt          | t          j                  rt          j        |           g} nGt          | t                    s2d}t          |                    | t          |                               t          | |          }|j        }	 |rE|D ]B}t          |t                    r|                    |           -|                    |           C|j                            ||           }|S # t"          $ r |                                  w xY w)Nr   zG`args` parameter expected to be a list of strings, got: {!r} (type: {}))r   rd   )rx   argv
isinstancera   PathLikefspathlist	TypeErrorformatrX   r   r   r\   consider_pluginargregisterrr   pytest_cmdline_parseBaseExceptionrt   )rd   re   r   ri   r   plugins         rK   rq   rq   C  sJ    |x|	D"+	&	& 6	$ d## 6U 	 

4d44555g&&F(M 	3! 3 3fc** 3!44V<<<<!**62222#88'd 9 
 
    ""$$$s   'A$D  D,c                 <    |                                  r| j        S | S )z<Get the directory of a path - itself if already a directory.)is_fileparent)rN   s    rK   _get_directoryr   c  s    ||~~ {rJ   method	hook_type	opt_names.c                     t           rt          j        |           sJ d t          | dg           D             }g }i }|D ]h}t          | |t                    }|t          ur |                    | d|            d||<   A||v r|                    | d           d||<   cd||<   i|rdd                    |          }t          j        j	        
                    || j        |          }	t          t          t          |           |	           |S )	Nc                     h | ]	}|j         
S rI   name).0ms     rK   	<setcomp>z)_get_legacy_hook_marks.<locals>.<setcomp>s  s    OOOQVOOOrJ   
pytestmark=Tz=TrueF, )rX   fullname	hook_opts)r   inspect	isroutinegetattrAttributeErrorappendjoin_pytest
deprecatedHOOK_LEGACY_MARKINGr   rA   r2   r	   r   )
r   r   r   known_marks	must_warnoptsopt_nameopt_attrr   messages
             rK   _get_legacy_hook_marksr  k  sI   
  ) (((((OOWV\2-N-NOOOKID 	# 	#68^<<>))55855666!DNN$$///000!DNN"DNN ?IIi((	$8??( @ 
 

 	$|V44g>>>KrJ   c                       e Zd ZdZd3 fdZdededee         f fdZ	dedee
         f fdZ	 d4dedee         dee         f fd	Zdefd
ZdedefdZd5dZdeeeef                  dedededee         dedeeef         deddfdZdedefdZdedeeef         dededdf
dZdedeeef         dededdf
dZdedeej                 fdZdededeej        ef         fdZdedeeef         dededej        f
d Zd!ej        deddfd"Z d#d$dee         d%eddfd&Z!d'eddfd(Z"d)ej        d*eddfd+Z#d3d,Z$d!ej        ddfd-Z%d.edej        eee         f         ddfd/Z&d6d0ed1eddfd2Z' xZ(S )7r   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.
    rP   Nc                     dd l }t                                          d           t                      | _        i | _        d | _        d| _         t          d          t                    | _	        g | _
        |                     |j                   |                     |            t          j                            d          rt"          j        }t'          |dd          }	 t)          t          j        |                                          |j        d|	          }n# t0          $ r Y nw xY w| j        j                            |j                   |                                  |j                                        | _         d| _!        d S )
Nr   r8   F   PYTEST_DEBUGencodingutf8r   )mode	bufferingr  )"_pytest.assertionsuperrT   set_conftest_plugins_dirpath2confmods_confcutdir_noconftestr   r   skipped_pluginsadd_hookspecshookspecr   ra   ro   rp   rx   ry   r   r   dupr   r	  r[   traceroot	setwriterwriteenable_tracingr   DummyRewriteHookrewrite_hook_configured)rS   r   errr  	__class__s       rK   rT   zPytestPluginManager.__init__  s|       """ 9< FH+/ 
 -inn^<< 797+,,,d:>>.)) 	":C#CV<<HF3::<<((%	      JO%%ci000!!! $->>@@ s   $<D! !
D.-D.r   r   c                     |                     d          sdS |dk    rdS t                                          ||          }||S t          ||          }t	          j        |          sdS t          |dd          S ):meta private:pytest_Npytest_pluginsimpl)tryfirsttrylastoptionalhookhookwrapper)
startswithr  parse_hookimpl_optsr   r   r   r  )rS   r   r   r   r   r  s        rK   r*  z'PytestPluginManager.parse_hookimpl_opts  s     y)) 	4###4ww**6488K&& (( 	4%FR
 
 	
rJ   c                     t                                          ||          }|6t          ||          }|                    d          rt	          |dd          }|S )r!  Nr"  r   )firstresulthistoric)r  parse_hookspec_optsr   r)  r  )rS   module_or_classr   r   r   r  s        rK   r.  z'PytestPluginManager.parse_hookspec_opts  sc    ww**?DAA<_d33Fy)) -/ 
 rJ   c           
         |t           j        j        v rJt          j        t          d                    |                    dd                                         d S t                      	                    ||          }|_| j
        j                            t          |||                      t          |t          j                  r|                     |           |S )NzQ{} plugin has been merged into the core, please remove it from your requirements._-)r   plugin_namemanagerkwargs)r   r   DEPRECATED_EXTERNAL_PLUGINSr   warnr1   r   replacer  r   rr   pytest_plugin_registeredcall_historicdictr   types
ModuleTypeconsider_module)rS   r   r   r3  r  s       rK   r   zPytestPluginManager.register  s     7%AAAM#??EvS#..@ @    4gg&&vt44"I.<<! +    =    &%"233 -$$V,,,rJ   c                 0    |                      |          }|S rR   )
get_plugin)rS   r   r   s      rK   	getpluginzPytestPluginManager.getplugin
  s    *.//$*?*?rJ   c                 F    t          |                     |                    S )z:Return whether a plugin with the given name is registered.)boolrA  )rS   r   s     rK   	haspluginzPytestPluginManager.hasplugin  s    DOOD))***rJ   ri   r   c                 l    |                     dd           |                     dd           d| _        dS )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  )rS   ri   s     rK   pytest_configurez$PytestPluginManager.pytest_configure  sX     	G	
 	
 	
 	F	
 	
 	
  rJ   rd   pyargs
noconftestrootpath
confcutdirinvocation_dir
importmodeconsider_namespace_packagesc                   |rt          ||z            nd| _        || _        || _        d}	|D ]r}
t	          |
          }|                    d          }|dk    r
|d|         }t          ||z            }t          |          r|                     ||||           d}	s|	s|                     ||||           dS dS )a`  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.
        NFz::rP  T)r*   r  r  _using_pyargsr\   findr/   _try_load_conftest)rS   rd   rJ  rK  rL  rM  rN  rO  rP  foundanchorintitial_pathrN   ianchors                 rK   _set_initial_conftestsz*PytestPluginManager._set_initial_conftests(  s   ( :DML*4555 	 &#! 	# 	#M}%%D		$ABwwBQBx!.4"788F 6"" #''0K	 (    # 	##,G	 $     	 	rJ   rN   c                 0    | j         dS || j         j        vS )z:Whether to consider the given path to load conftests from.NT)r  parents)rS   rN   s     rK   _is_in_confcutdirz%PytestPluginManager._is_in_confcutdir[  s#    #4 4+333rJ   rZ  c                    |                      ||||           |                                rE|                    d          D ]1}|                                r|                      ||||           0d S d S )NrS  ztest*)_loadconftestmodulesis_dirglob)rS   rZ  rO  rL  rP  xs         rK   rV  z&PytestPluginManager._try_load_conftestj  s     	!!(C	 	" 	
 	
 	
 ==?? 	[[))  88:: --" 4O	 .   	 	 rJ   c                ^   | j         rd S |                     |          }|| j        v rd S g }t          |g|j        R           D ]^}|                     |          rG|dz  }|                                r.|                     ||||          }	|                    |	           _|| j        |<   d S )Nzconftest.pyrS  )	r  r   r  reversedr]  r^  r   _importconftestr   )
rS   rN   rO  rL  rP  	directoryclistr   conftestpathmods
             rK   r`  z(PytestPluginManager._loadconftestmodules  s      	F''--	 ...F	>I,=>>?? 
	& 
	&F%%f-- 	&%5'')) &..$" 4O	 /  C LL%%%,1y)))rJ   c                 b    |                      |          }| j                            |d          S )NrI   )r   r  rp   )rS   rN   rg  s      rK   _getconftestmodulesz'PytestPluginManager._getconftestmodules  s.    ''--	%)))R888rJ   c                     |                      |          }t          |          D ]&}	 |t          ||          fc S # t          $ r Y #w xY wt	          |          rR   )rl  re  r   r   KeyError)rS   r   rN   modulesrj  s        rK   _rget_with_confmodz&PytestPluginManager._rget_with_confmod  sz    
 **400G$$ 	 	CGC......!   tnns   <
A	A	ri  c          
         t          |          }|                     |          }|t          t          j        |          S t          |          }|$	 t          j        |j        = n# t          $ r Y nw xY w	 t          ||||          }n-# t          $ r }	|	j        J t          ||	          |	d }	~	ww xY w|                     ||           | j                            |           |j        }
|
| j        v re| j                                        D ]K\  }}|
|j        v s||
k    r7||v rt+          d|d| d|j         d          |                    |           L|                     d|           |                     ||           |S )	N)r	  r  rP  )rO   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\   rA  r	   r=  r>  r.   rx   ro  stemrn  r,   r[   __traceback__rM   _check_non_top_pytest_pluginsr  addr   r  itemsr]  AssertionError__file__r   r  consider_conftest)rS   ri  rO  rL  rP  conftestpath_plugin_nameexistingpkgpathrj  r   dirpathrN   modss                rK   rf  z#PytestPluginManager._importconftest  s    $'|#4#4 ??#;<<((333 '|44?K 122   		F,G	  CC  	F 	F 	F?...'A>>>AE	F 	**3===""3'''%d,,,"4::<< % %
ddl**dgood{{,b, b b58b bWZWcb b b  
 KK$$$

4S44555s6NOOO
s*   A& &
A32A37B 
B5B00B5rj  c                     t          |d          r<| j        r7| j        s2d}t          |                    || j                  d           d S d S d S d S )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  rT  r(   r   r  )rS   rj  ri  r   s       rK   ru  z1PytestPluginManager._check_non_top_pytest_plugins  s     C)**	L 	L &	Lw  L$*:;;UKKKKKK	L 	L 	L 	L 	L 	LrJ   Fr   r   c                   d}t          |          }||k     r||         }|dz  }t          |t                    r|dk    r!	 ||         }n# t          $ r Y dS w xY w|dz  }n!|                    d          r|dd         }np|                                }|r|                    d          s|                     |           ||k     dS dS )r!  r   r   z-pNr;   no:)lenr   r\   
IndexErrorr)  stripr   )rS   rd   r   rY  noptpargs          rK   r   z%PytestPluginManager.consider_preparse  s     II!eeq'CFA#s## .$;;#Aw%   FAA^^D)) qrr7DDzz|| (>(> ''---# !eeeeees   A
 

AAargc                    |                     d          r|dd         }|t          v rt          d|z            |dk    r*|                     d           |                     d           |                     |           |                     d          s|                     d|z              dS dS |}|                     |           |                     d          s|                     d|z              |                     |d	
           dS )r!  r  r<   Nzplugin %s cannot be disabledr   r   pytest_stepwiser"  T)consider_entry_points)r)  essential_pluginsr"   set_blockedunblockr   )rS   r  r   s      rK   r   z&PytestPluginManager.consider_pluginarg  s.   >>%   	@qrr7D((( !?$!FGGG &&  ,,,  !2333T"""??9-- 3  T!1222223 3 DLL??9-- /Y-...s$?????rJ   conftestmodulerr  c                 4    |                      ||           dS )r!  r   N)r   )rS   r  rr  s      rK   rz  z%PytestPluginManager.consider_conftest3  s!     	n+<=====rJ   c                 j    |                      t          j                            d                     dS )r!  PYTEST_PLUGINSN)_import_plugin_specsra   ro   rp   rY   s    rK   consider_envz PytestPluginManager.consider_env9  s+    !!"*..1A"B"BCCCCCrJ   c                 N    |                      t          |dg                      dS )r!  r#  N)r  r   )rS   rj  s     rK   r?  z#PytestPluginManager.consider_module=  s)    !!'#/?"D"DEEEEErJ   r   c                 X    t          |          }|D ]}|                     |           d S rR   )_get_plugin_specs_as_listr   )rS   r   re   import_specs       rK   r  z(PytestPluginManager._import_plugin_specsA  sA     ,D11" 	, 	,K{++++	, 	,rJ   modnamer  c                    t          |t                    sJ d|z              |                     |          s|                     |          dS |t          v rd|z   n|}| j                            |           |r|                     d|          }|rdS 	 t          |           t          j
        |         }|                     ||           dS # t          $ r>}t          d| d|j        d                                        |j                  |d}~wt           $ r.}| j                            ||j        pd	f           Y d}~dS d}~ww xY w)
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 %rNz_pytest.pytest11r   zError importing plugin "z": r    )r   r\   
is_blockedrA  builtin_pluginsr  mark_rewriteload_setuptools_entrypoints
__import__rx   ro  r   ImportErrorrd   with_tracebackrt  r)   r  r   r   )rS   r  r  
importspecloadedrj  r   s          rK   r   z!PytestPluginManager.import_pluginH  s    '3'' 	
 	
2W<	
 	
 	
 ??7## 	tw'?'?'KF-4-G-GZ'))W
&&z222  	55jw5OOF 	(z""" +j)CMM#w'''''  	5 	5 	5B7BBqvayBB nQ_--15  	@ 	@ 	@ ''!%+2(>?????????	@s$   C 
E9DE #E		ErP   NrR   )ri   r   rP   N)F))r?   r@   rA   rB   rT   _PluggyPluginr\   r   r   r*  r   r.  r   rB  rD  rE  rI  r   r   r   r-   r[  r^  rV  r`  r=  r>  rl  r   r   rp  rf  ru  r   r   rz  r  r?  r  r   __classcell__)r  s   @rK   r   r     s        1! 1! 1! 1! 1! 1!f
#
+.
	,	
 
 
 
 
 
4 ,AW       <@ #+3C=	#     6c    
+c +d + + + +       *1uS$Y'(1 1 	1
 1 TN1 1 *c/*1 &*1 
1 1 1 1f4d 4t 4 4 4 4 #z/* 	 &* 
   222 #z/*2 	2 &*2 
2 2 2 2@9 9%:J1K 9 9 9 9  
u$	%	   33 #z/*3 	3 &*3 
	3 3 3 3jLL L 
	L L L L6 <A. . .SM.48.	. . . .2@c @d @ @ @ @.>#.>CF>	> > > >D D D DF5#3 F F F F F,$ 0#x}DE,	, , , ,#( #(S #( #(RV #( #( #( #( #( #( #( #(rJ   specsc                    | g S t          | t          j                  rg S t          | t                    r| r|                     d          ng S t          | t
          j        j                  rt          |           S t          d| z            )z:Parse a plugins specification into a list of plugin names.N,zYPlugins may be specified as a sequence or a ','-separated string of plugin names. Got: %r)
r   r=  r>  r\   r`   collectionsabcr   r   r"   )r  s    rK   r  r  n  s    
 }	%)** 	% 1#(0u{{3b0%122 E{{
c
	  rJ   c                       e Zd Zd ZdS )Notsetc                     dS )Nz<NOTSET>rI   rY   s    rK   __repr__zNotset.__repr__  s    zrJ   N)r?   r@   rA   r  rI   rJ   rK   r  r    s#            rJ   r  package_filesc              #   x  K   t          |           } d}| D ]}d|vo|                    d          }|                    d          dk    o|                    d          }|rDt          j                            |          \  }}|dk    r|                    d          sd}|V  |r%t          j                            |          }d}|V  |sig }| D ]K}|                    d          }	d	                    |	dd	                   }
|
r|
                    |
           L|rt          |          E d	{V  d	S d	S d	S )
aM  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countra   rN   splitextr)  dirnamer`   r   r   _iter_rewritable_modules)r  	seen_somefnis_simple_module
is_packagemodule_namer1  package_namenew_package_filespartsnew_fns              rK   r  r    s     @ ''MI  b=?R[[-?-?XXc]]a'FBKK,F,F
 
	W--b11NK g%%k.D.D^.T.T% 	!!!! 	7??2..LI C  	1 	1BHHSMMEXXeABBi((F 1!((000 	C/0ABBBBBBBBBBBC C	C 	CrJ   c                   
   e Zd ZU dZe ej        d           G d d                                  Z G d dej	                  Z
dd	d
edee         ddfdZedefd            Zedee         fd            Zdeg df         ddfdZd\dZd\dZdefdZd
edee         dd fdZ	 d]dee         deej                 ddfdZdedefdZ e!d^d            Z"d_dZ# e$d           d`d"            Z%de&e         ddfd#Z'de&e         ddfd$Z(d\d%Z)dee         d&edee         fd'Z*dee         d(e+d)ee         d*ed+ed,e+de,ee         e
f         fd-Z-dadee         d.e+ddfd/Z. e$d0          de/de0e0f         fd1            Z1d\d2Z2d\d3Z3d\d4Z4d5eddfd6Z5dee         fd7Z6dadee         d.e+ddfd8Z7d9e8d:e9ddfd;Z:d<ed=eddfd>Z;d<efd?Z<d<ed@edAe=eee         f         fdBZ>d<efdCZ?d<edDedeee                  fdEZ@d<edee         fdFZAeBdGfd<edHe+fdIZCd]d<efdJZDd]d<efdKZEdLZFeGeHdM<   dNZIeGeHdO<   dPZJeGeHdQ<   d]dRee         de9fdSZKeLdRedefdT            ZMeLdUdVdRedWeddfdX            ZNdYeddfdZZOd\d[ZPdS )br   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                       e Zd ZU dZeedf         ed<   	 eee	ee
f                           ed<   	 eed<   	 dee         deee	ee
f                           deddfdZdS )	Config.InvocationParamsa  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.
        .rd   re   r   rP   Nc                    t                               | dt          |                     t                               | d|           t                               | d|           d S )Nrd   re   r   )object__setattr__tuple)rS   rd   re   r   s       rK   rT   z Config.InvocationParams.__init__  sX     tVU4[[999tY888tUC00000rJ   )r?   r@   rA   rB   r   r\   __annotations__r   r   r   r  r   r   rT   rI   rJ   rK   r   r    s         	 	 CHoJ(5m);#<=>>>>-			G		1 3-		1 huS--?'@AB			1
 		1 		1 		1 		1 		1 		1 		1rJ   r   c                   p    e Zd ZdZ ej                    Z ej                    ZeZ ej                    Z	dS )Config.ArgsSourcezSIndicates the source of the test arguments.

        .. versionadded:: 7.2
        N)
r?   r@   rA   rB   enumautoARGSINVOCATION_DIRINCOVATION_DIR	TESTPATHSrI   rJ   rK   
ArgsSourcer    sF        	 	 ty{{"'DIKK			rJ   r  Nr   r   r   rP   c                *   ddl m} ddl m} |)|                     dd t	          j                              }t          j                    | _        	 || _	        	 |} |d| d| d| j
        d	
          | _        || _        	 t                      | _        	 | j        | _        | j        j        j                            d          | _        t'          | j        j                  | _        i | _        d| _        i | _        g | _        | j                            | d           d| _        | j        j                            t;          | j        | j                             t<          j        j         | _!        g | _"        tF          rddl$m%} d | _&        d S d S )Nr   )FILE_OR_DIRr4   rI   r   z%(prog)s [options] [z] [z] [...]T)usage
processopt	_ispytestri   pytestconfigF)parserr   r5  r   )Cache)'
argparsingr  r5   r   r   r   argparse	Namespaceoptionr   _processopt_parserr   r0   stash_storer  r  rp   r    rr   	_inicache_override_ini	_opt2dest_cleanupr   r  pytest_addoptionr;  r<  r   r  r  args_sourcerd   r   _pytest.cacheproviderr  cache)rS   r   r   r  r5   _ar  s          rK   rT   zConfig.__init__
  s    	,+++++&&&&&&$ $ 5 548:: !6 ! ! (**	
 "3	
 v;;;;;;'
 
 

 +	
 WW
	 j'-266x@@
&89K9P&Q&Q	)+,.)+24##D.999 	"00t|4;MNNN 	1 	
 	
 	
 ",1!	 	/333333*.DJJJ	/ 	/rJ   c                     | j         S )znThe path to the :ref:`rootdir <rootdir>`.

        :type: pathlib.Path

        .. versionadded:: 6.1
        )	_rootpathrY   s    rK   rL  zConfig.rootpathL  s     ~rJ   c                     | j         S )zThe path to the :ref:`configfile <configfiles>`.

        :type: Optional[pathlib.Path]

        .. versionadded:: 6.1
        )_inipathrY   s    rK   inipathzConfig.inipathV  s     }rJ   funcc                 :    | j                             |           dS )zxAdd a function to be called when the config object gets out of
        use (usually coinciding with pytest_unconfigure).N)r  r   )rS   r  s     rK   add_cleanupzConfig.add_cleanup`  s      	T"""""rJ   c                    | j         rJ d| _         t          j                    5  t          j        d           | j        j                            t          |                      d d d            d S # 1 swxY w Y   d S )NTdefaultrh   r5  )r  r   catch_warningssimplefilterrr   rI  r;  r<  rY   s    rK   _do_configurezConfig._do_configuree  s    ####$&& 	O 	O!),,,I&44D<M<M<M4NNN	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	O 	Os   AA44A8;A8c                     | j         r3d| _         | j                            |            g | j        j        _        | j        r,| j                                        } |             | j        *d S d S )NFrh   )r  rr   pytest_unconfigurerI  _call_historyr  ru   )rS   fins     rK   rt   zConfig._ensure_unconfigurel  s     	:$DI(((55579DI&4m 	-##%%CCEEE m 	 	 	 	 	rJ   c                 L    | j                             d          }|J |j        S )Nterminalreporter)r   rA  _tw)rS   r  s     rK   get_terminal_writerzConfig.get_terminal_writeru  s5    7;7I7T7T8
 8
  +++##rJ   rd   c                 z   	 |                      |           n# t          $ r t          | j        dd          sd|v rddlm}  ||            nht          | j        dd          sd|v sd|v rJ| j                                                                         t          j
                            d	            w xY w| S )
NversionFz	--versionr   )showversionhelpz--helpz-hz8
NOTE: displaying only minimal help due to UsageError.

)parser"   r   r  _pytest.helpconfigr
  r  
_getparser
print_helprx   r   r  )rS   r   rd   r
  s       rK   r   zConfig.pytest_cmdline_parse|  s    	JJt 	 	 	 t{Iu55 
9L9L::::::D!!!!VU337?47G7G4SW<<''))44666
  Q   !	$ s
    B B8excinfor  c                    |rt          |dd          rd}nd}|                    dt          |dd          |          }| j                            ||          }t	          |          set          |                              d	          D ]D}t          j        	                    d
|z             t          j        
                                 Cd S d S )N	fulltraceFlongnativeT
showlocals)funcargsr  rl   )excreprr  rn   zINTERNALERROR> %s
)r   r}   rr   pytest_internalerroranyr\   r`   rx   ry   r  r   )rS   r  r  rl   r  resrz   s          rK   notify_exceptionzConfig.notify_exception  s    
  	gfk599 	%+EEE//gflE&J&JRW " 
 
 i,,Wg,NN3xx 	#G**400 # #
  !6!=>>>
  """"	# 	## #rJ   nodeidc                 x    | j         j        | j        k    r$| j        |z  }t          | j         j        |          }|S rR   )r   r   rL  r+   )rS   r  fullpaths      rK   cwd_relative_nodeidzConfig.cwd_relative_nodeid  s;    !%66}v-H !7!;XFFFrJ   c                     t          |          }|j        j                            |           |                    |d           |j        j        D ]}|j                            |           |S )z$Constructor usable for subprocesses.Faddopts)r   r  __dict__updater  re   r   r   )clsoption_dictrd   ri   rc  s        rK   fromdictargszConfig.fromdictargs  ss     D!!%%k222T5)))& 	7 	7A 33A6666rJ   r  r3   c                     |j         |j        z   D ]}|j        | j        |<   t	          |d          r<t	          | j        |j                  s$t          | j        |j        |j                   d S d S d S )Nr  )_short_opts
_long_optsdestr  r  r  setattrr  )rS   r  r   s      rK   r  zConfig._processopt  s    Ocn4 	, 	,D#&8DN4  3	"" 	<4;11 <SXs{;;;;;	< 	<< <rJ   )r&  early_configc                    |                     |j        j        |j        j        |                    d          |j        j        |j        d          \  }}| j        	                    ||j        j        |j        j
        |j        |j        j        |j        j        |j        j        |                    d                     d S )N	testpathsFrd   rJ  r/  rN  rL  r8  rP  )rd   rJ  rK  rL  rM  rN  rO  rP  )_decide_argsknown_args_namespacefile_or_dirrJ  getinir   r   rL  r   r[  rK  rM  rO  )rS   r-  rd   r  s       rK   pytest_load_initial_conftestsz$Config.pytest_load_initial_conftests  s     )552>4;"))+66'9=!* 6 
 
k 	114;#8C!*#8C'9=#8C(4(;(;-) ) 	2 	
 	
 	
 	
 	
rJ   c                 P   | j                             |t          j        | j                            \  }}t	          |j        |j        |z   |j        pd | j        j	                  \  }}}|| _
        || _        || _        t          | j                  | j         j        d<   t          | j                  | j         j        d<   | j                             ddd           | j                             dd	           | j                             d
ddg            |j        pd| _        d S )N	namespace)inifilerd   rootdir_cmd_argrN  rootdirr9  r"  zExtra command line optionsrd   
minversionz!Minimally required pytest versionrequired_pluginsz.Plugins that must be present for pytest to run)rX   r  rI   )r  parse_known_and_unknown_argscopyr  r#   inifilenamer3  r;  r   r   r  r  inicfgr\   rL  
extra_infor  addinioverride_inir  )rS   rd   nsunknown_argsrL  r  rA  s          rK   _initinizConfig._initini  s3   <DDDIdk22 E 
 
L %4N,.J.$15	%
 %
 %
!'6 "-0-?-?	*-0->->	*I'CVLLLL*MNNN<	 	 	
 	
 	
  _2rJ   c                 &   | j                             |          \  }}t          |dd          }|dk    rGddl}	 |j                            |           }|                     |           n# t          $ r d}Y nw xY w|                     |           dS )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  r>  r   r  r   install_importhook_mark_plugins_for_rewriteSystemError_warn_about_missing_assertion)rS   rd   rE  rF  r	  r   rr   s          rK   _consider_importhookzConfig._consider_importhook  s      <DDTJJLr<119$$$$5(;;DAA ..t4444     	**400000s   A* *A98A9c                     || j         _        t          j                            d          rdS d t
          j                                        D             }t          |          D ]}|	                    |           dS )zGiven an importhook, mark for rewrite any top-level
        modules or packages in the distribution package for
        all pytest plugins.PYTEST_DISABLE_PLUGIN_AUTOLOADNc              3      K   | ]=}t          d  |j        D                        |j        pg D ]}t          |          V  >dS )c              3   ,   K   | ]}|j         d k    V  dS )r  N)group)r   eps     rK   	<genexpr>z=Config._mark_plugins_for_rewrite.<locals>.<genexpr>.<genexpr>  s)      FFb28z)FFFFFFrJ   N)r  entry_pointsfilesr\   )r   distfiles      rK   rW  z3Config._mark_plugins_for_rewrite.<locals>.<genexpr>  s~       
 
FFD4EFFFFF
 
(b	
 
  II
 
 
 
 
 
 
rJ   )
r   r  ra   ro   rp   r_   metadatadistributionsr  r  )rS   rr   r  r   s       rK   rM  z Config._mark_plugins_for_rewrite  s     +/':>>:;; 	F
 
!*88::
 
 
 -];; 	$ 	$Dd####	$ 	$rJ   viac                     || j         _        	 | j                             |t          j        | j                             | j         `n# | j         `w xY w|S )zValidate known args.r7  )r  _config_source_hintr>  r?  r  )rS   rd   r^  s      rK   _validate_argszConfig._validate_args  sg    +.(	1L55	$+ 6 6 6    0000000s   3A	 		ArJ  r/  rN  rL  r8  c          	         |rt           j        j        }|}n||k    rt           j        j        }|r|}nlg }|D ]8}	|                    t          t          j        |	d                               9|r*|s(|r&d}
|                     t          |
          d           ng }|s!t           j        j
        }t          |          g}||fS )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.r<   
stacklevel)r   r  r  r  extendsortedrb  iglobissue_config_time_warningr1   r  r\   )rS   rd   rJ  r/  rN  rL  r8  sourceresultrN   warning_texts              rK   r1  zConfig._decide_args(  s      	/&+FFF))*4 &FFF ) P PfTZ-M-M-M&N&NOOOO  	 	 !\ )
 !:: 3L A Aa ;     /*9n--.v~rJ   r"  c                 R   |r_t           j                            dd          }t          |          r0|                     t          j        |          d          |z   |d d <   |                     |           |r1|                     |                     d          d          |z   |d d <   | j	        
                    |t          j        | j                            | _        |                                  |                     |           | j                            |d           t           j                            d	          s| j                            d
           | j                                         | j	        
                    |t          j        | j                            | _        |                                  |                                  | j        j        A| j        t1          | j        j                  }nt1          | j                  }|| j        _        	 | j                            | || j	                   d S # t:          $ rQ}| j        j        s| j        j        r-|                      tC          d|j"                   d           n Y d }~d S d }~ww xY w)NPYTEST_ADDOPTSr  zvia PYTEST_ADDOPTSr"  zvia addopts configr7  Fr   rR  r  )r-  rd   r  z"could not load initial conftests: r;   rd  )#ra   ro   rp   r  ra  shlexr`   rG  r4  r  parse_known_argsr?  r  r2  _checkversionrP  r   r   r  r  _validate_plugins_warn_about_skipped_pluginsrM  r  r\   r   rL  rr   r5  rM   r  r	  ri  r1   rN   )rS   rd   r"  env_addoptsrM  r   s         rK   	_preparsezConfig._preparseU  s    	*..)92>>K; ''K(@(@BVWW QQQ 	d 	##DKK	$:$:<PQQTXX G %)L$A$ADIdk22 %B %
 %
! 	!!$''',,T,FFFz~~>?? 	G :::FFF'')))$(L$A$ADId&?@@ %B %
 %
! 	   ((***$/7|' !455

 //
3=D%0	I33!T\ 4      % 		 		 		(- 1J1R  ..'(UQV(U(UVV  /    
      			s   '"I 
J&AJ!!J&)wrapperc              #   j   K   	 d V |                                   S # |                                   w xY wrR   )_validate_config_optionsrY   s    rK   pytest_collectionzConfig.pytest_collection  s?      	,EE))++++D))++++s    2c                 F   dd l }| j                            dd           }|r}ddlm} t          |t                    s|                    d| j        z             ||           ||j	                  k    r*|                    | j         d| d|j	         d          d S d S )Nr   r<  Versionz'%s: 'minversion' must be a single valuez: 'minversion' requires pytest-z, actual pytest-')
r8   rA  rp   packaging.versionr|  r   r\   r"   r  r$   )rS   r8   minverr|  s       rK   rq  zConfig._checkversion  s    t44 	111111fc** ''=L   wv);!<!<<<''|qqFqq\b\nqqq  	 	 =<rJ   c                     t          |                                           D ]}|                     d| d           d S )NzUnknown config option: rn   )rg  _get_unknown_ini_keys_warn_or_fail_if_strict)rS   keys     rK   rx  zConfig._validate_config_options  sV    $446677 	L 	LC(()J3)J)J)JKKKK	L 	LrJ   c                 ^   t          |                     d                    }|sd S ddlm} ddlm} ddlm} | j                                        }d |D             }g }|D ]}	  ||          }	n # |$ r |	                    |           Y +w xY w|	j
        |vr|	                    |           N|	j                             |||	j
                           d          s|	                    |           |r5t          d	                    d
                    |                              d S )Nr=  r   )InvalidRequirement)Requirementr{  c                 .    i | ]\  }}|j         |j        S rI   )project_namer	  )r   r1  rZ  s      rK   
<dictcomp>z,Config._validate_plugins.<locals>.<dictcomp>  s#    WWW4D-t|WWWrJ   T)prereleaseszMissing required plugins: {}r   )rg  r4  packaging.requirementsr  r  r~  r|  r   list_plugin_distinfor   r   	specifiercontainsr"   r   r   )
rS   r=  r  r  r|  plugin_infoplugin_dist_infomissing_pluginsrequired_pluginreqs
             rK   rr  zConfig._validate_plugins  s   !$++.@"A"ABB 	F 	>=====666666------(==??WW;WWW/ 	8 	8O!k/22%   &&777 x///&&7777]++(233 ,   8  &&777 	.55dii6P6PQQ  	 	s   %A11BBr  c                     | j         j        rt          |          |                     t	          |          d           d S )Nr<   rd  )r2  strict_configr"   ri  r1   )rS   r  s     rK   r  zConfig._warn_or_fail_if_strict  sG    $2 	&W%%%&&':7'C'CPQ&RRRRRrJ   c                 B    | j         j        fd| j        D             S )Nc                     g | ]}|v|	S rI   rI   )r   r   parser_inicfgs     rK   
<listcomp>z0Config._get_unknown_ini_keys.<locals>.<listcomp>  s#    JJJM0I0I0I0I0IrJ   )r  _inidictrA  )rS   r  s    @rK   r  zConfig._get_unknown_ini_keys  s)    -JJJJJJJJrJ   c                    | j         g k    s
J d            | j        j                            t	          | j                             |                     ||           d| j        _        	 | j        	                    || j
        | j
                  }|                     || j        j        |                     d          | j        j        | j        d          \  | _         | _        d S # t&          $ r Y d S w xY w)	Nz:can only parse cmdline args at most once per Config object)r   r5  r!  Tr7  r/  r0  )rd   rr   pytest_addhooksr;  r<  r   ru  r  after_preparseparse_setoptionr  r1  r2  rJ  r4  r   r   rL  r  r!   )rS   rd   r"  s      rK   r  zConfig.parse  s    IOOOG OO	!//d&8999 	0 	
 	
 	
 	tW---&*#	<//dkT[ 0  D +/*;*;07++k22#59 +< + +'DIt'''  	 	 	DD	s   -A;C* *
C87C8warningre  c                 N   | j                             d          rdS | j        j        pg }|                     d          }t          j        d          5 }t          j        dt          |                     t          ||           t          j
        ||           ddd           n# 1 swxY w Y   |rnt          j        |dz
            }|j        j        |j        |j        j        f}| j        j                            t)          |d	         d
d|                     dS dS )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alwaysrd  r   r   ri   r  )warning_messagewhenr  locationr5  )r   r  r2  pythonwarningsr4  r   r  r  rX   apply_warning_filtersr8  rx   	_getframef_codeco_filenamef_linenoco_namerr   pytest_warning_recordedr;  r<  )rS   r  re  cmdline_filtersconfig_filtersrecordsframer  s           rK   ri  z Config.issue_config_time_warning  su    ((44 	F3BHb%566$D111 	:W!(DMM:::!./BBBM'j9999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:
  
	M*q.11E|/AUUHI-;;$+AJ!%	   <     
	 
	s   A	B**B.1B.r   rz   c                     |                      |          }t          |t                    sJ |                    |           dS )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)r4  r   r   r   )rS   r   rz   rc  s       rK   rH  zConfig.addinivalue_line  s>     KK!T"""""	rJ   c                     	 | j         |         S # t          $ r$ |                     |          x| j         |<   }|cY S w xY w)a8  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  rn  _getini)rS   r   vals      rK   r4  zConfig.getini  sU    8	>$'' 	 	 	)-d););;DN4 3JJJ	s    +==rX   valuec                 ,    d| }t          ||          )Nzunknown configuration type: )rv   )rS   r   rX   r  r   s        rK   _getini_unknown_typezConfig._getini_unknown_type=  s    3T33e$$$rJ   c                 T  	 	 | j         j        |         \  }}}n%# t          $ r}t          d|          |d }~ww xY w|                     |          }|!	 | j        |         }n# t          $ r |cY S w xY w|}|dk    rX| j        | j        j        n| j        j	        	t          |t                    rt          j        |          n|}	fd|D             S |dk    r+t          |t                    rt          j        |          n|S |dk    rEt          |t                    r.d t          d |                    d                    D             S |S |d	k    r.t          t          |                                                    S |d
k    r|S ||S |                     |||          S )Nzunknown configuration value: pathsc                     g | ]}|z  S rI   rI   )r   rc  dps     rK   r  z"Config._getini.<locals>.<listcomp>d  s    111qBF111rJ   rd   linelistc                     g | ]}||S rI   rI   )r   ts     rK   r  z"Config._getini.<locals>.<listcomp>i  s    TTTaRSTTTTrJ   c                 *    |                                  S rR   r  )rc  s    rK   <lambda>z Config._getini.<locals>.<lambda>i  s     rJ   rn   rD  string)r  r  rn  rv   _get_override_ini_valuerA  r  r   r   r   r   r\   ro  r`   map
_strtoboolr  r  )
rS   r   descriptionrX   r  r   override_valuer  input_valuesr  s
            @rK   r  zConfig._getiniA  s   	N)-)>t)D&Kww 	N 	N 	NETEEFFAM	N55d;;!D)    #E  7?? <+ ##+/ 
 2<E31G1GR5;u---UL1111L1111V^^)3E3)?)?J5;u%%%UJZ%%% TT3':':EKK<M<M#N#NTTTTV^^c%jj..00111XL\L,,T4???s"    
<7<A% %A43A4rN   c                    	 | j                             ||          \  }}n# t          $ r Y d S w xY w|j        J t	          |j                  j        }g }|D ]s}t          |t          j                  rt	          |          }n2|	                    dt          j
                  }t          ||z            }|                    |           t|S )Nr  )r   rp  rn  ry  r   r   r   ra   r   r9  rb   r*   r   )rS   r   rN   rj  relrootsmodpathvaluesrelroots           rK   _getconftest_pathlistzConfig._getconftest_pathlistu  s    	 .AA$MMMC 	 	 	44	|'''s|$$+ 	# 	#G'2;// :w--!//#rv66&w'899MM'""""s   ! 
//c                     d }| j         D ]J}	 |                    dd          \  }}||k    r|}%# t          $ r}t          d|d          |d }~ww xY w|S )Nr   r   z3-o/--override-ini expects option=value style (got: z).)r  r`   rv   r"   )rS   r   r  
ini_configr  user_ini_valuer   s          rK   r  zConfig._get_override_ini_value  s     , 		+ 		+J+&0&6&6sA&>&>#^ $;;*E     Z*ZZZ  s   /
AAAFskipc                 6   | j                             ||          }	 t          | j        |          }||rt	          |          |S # t          $ rG}|t
          ur|cY d}~S |rddl}|                    d|d           t          d|          |d}~ww xY w)ai  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: Default value if no option of that name exists.
        :param skip: If True, raise pytest.skip if option does not exists
            or has a None value.
        Nr   zno z option foundzno option named )	r  rp   r   r  r   notsetr8   r  rv   )rS   r   r  r  r  r   r8   s          rK   	getoptionzConfig.getoption  s     ~!!$--	A$+t,,C{t{$T***J 	A 	A 	Af$$ 97$77788888899q@	As#   )A 
B
BB!2BBc                 ,    |                      |          S )z$Deprecated, use getoption() instead.r  rS   r   rN   s      rK   getvaluezConfig.getvalue  s    ~~d###rJ   c                 0    |                      |d          S )z-Deprecated, use getoption(skip=True) instead.T)r  r  r  s      rK   getvalueorskipzConfig.getvalueorskip  s    ~~d~...rJ   
assertionsVERBOSITY_ASSERTIONS
test_casesVERBOSITY_TEST_CASESr  _VERBOSITY_INI_DEFAULTverbosity_typec                    | j         j        }t          |t                    sJ ||S t                              |          }|| j        j        vr|S |                     |          }|t          j	        k    r|S t          |          S )a4  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
        )
r  verboser   intr   _verbosity_ini_namer  r  r4  r  )rS   r  global_levelini_namelevels        rK   get_verbosityzConfig.get_verbosity  s    < {*,,,,,,!--n==4<000H%%F1115zzrJ   c                     d|  S )N
verbosity_rI   )r  s    rK   r  zConfig._verbosity_ini_name  s    ,N,,,rJ   r  r5   r  c                 |    |                      t                              |          |dt          j                   dS )a  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  )r  rX   r  N)rC  r   r  r  )r  r  r  s      rK   _add_verbosity_inizConfig._add_verbosity_ini  sF     	&&~661	 	 	
 	
 	
 	
 	
rJ   r	  c                     t                      s1|dk    rd}nd}|                     t          |          d           d S d S )NrJ  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?)
r<   rd  )_assertion_supportedri  r1   )rS   r	  rl  s      rK   rO  z$Config._warn_about_missing_assertion   sp    #%% 	w( 3  **#L11 +     	 	rJ   c           	      ~    | j         j        D ]/\  }}|                     t          d|d|           d           0d S )Nzskipped plugin rV   r;   rd  )r   r  ri  r1   )rS   r  r   s      rK   rs  z"Config._warn_about_skipped_plugins  sg     $ 2 B 	 	K**#$Lk$L$Ls$L$LMM +    	 	rJ   r  rR   )rP   r   )r  r3   rP   N)r-  r   rP   N)T)Qr?   r@   rA   rB   r   dataclasses	dataclassr   r  Enumr  r   r   rT   propertyr   rL  r  r   r  r  rt   r'   r  r   r\   r   r%   r   r  r  r  r  classmethodr'  r  hookimplr5  r   rG  rP  rM  ra  rD  r   r1  ru  r   r  ry  rq  rx  rr  r  r  r  Warningr  ri  rH  r4  r   r  r  r  r  r  r  r  r  r  r   r  r  r  r  r   r  r  rO  rs  rI   rJ   rK   r   r     su          [$'''1 1 1 1 1 1 1 (' U1B         TY      $ 9=	@/ @/ @/*@/ $$45	@/
 
@/ @/ @/ @/D $    X $    X#T 2 #t # # # #
O O O O   $^ $ $ $ $08<S		   8 04# #}-# +,# 
	# # # #$# #        [< < < < Xd
 
 
 
43Xc] 3t 3 3 3 321# 14 1 1 1 1($ $ $ $(
49 
3 
49 
 
 
 
+ 3i+ 	+
 9+ + + + 
tCy*$	%+ + + +Z4 4d3i 4$ 4$ 4 4 4 4l Xd,9T66-A#B , , , ,   $L L L L   BSs St S S S SKtCy K K K K $s) d d    2! !c !d ! ! ! !FS       3        H% %C %c4PS9n@U % % % %2@C 2@ 2@ 2@ 2@h# T htDz>R    "C HSM    " ,2 A Ac A A A A A0$ $S $ $ $ $/ /3 / / / /
 #/%...".%...$*E***+ +HSM +S + + + +Z -C -C - - - \- 
8 
S 
 
PT 
 
 
 \
"# $    *     rJ   c                  *    	 J # t           $ r Y dS w xY w)NFT)rx  rI   rJ   rK   r  r    s.       tts    
ri   r[  c                     t          |          }| j        j        dk    rd|_        n| j        j        dk    rd|_        | j        j        dk    rd|_        n| j        j        dk    rd|_        |S )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)ri   r[  r   s      rK   create_terminal_writerr  &  s|     
T	"	"	"B}e##			$	$}#u,, 		%	-	-!IrJ   r  c                 f    |                                  } | dv rdS | dv rdS t          d|           )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 )lowerrv   )r  s    rK   r  r  >  sJ     ))++C
222t	5	5	5u777888rJ   2   )maxsizer  escapezwarnings._ActionKindc          	      z   d}t          d|  d          }|                     d          }t          |          dk    rHd}t          dt          |           d| d	          }t          |                    |
                    t          |          dk     r(|                    d           t          |          dk     (d |D             \  }}}	}
}	 t          j        |          }nH# t          j        $ r6}t          |                    t          |          
                    dd}~ww xY w	 t          |	          }n[# t          $ rN t          j                    }|                    d          }t          |                    |
                    dw xY w|r|rt          j        |          }|
r|rt          j        |
          dz   }
|rb	 t#          |          }|dk     rt%          d          n># t$          $ r/}t          |                    d|d| 
                    dd}~ww xY wd}||||
|fS )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   >   K   | ]}|                                 V  d S rR   r  )r   ss     rK   rW  z'parse_warning_filter.<locals>.<genexpr>{  s*      3M3M!AGGII3M3M3M3M3M3MrJ   Nr  )rl   z\Zr   znumber is negativezinvalid lineno rV   )r   r`   r  r"   r   r   r   
_getaction_OptionErrorr\   _resolve_warning_categoryr[   r%   from_currentr}   rer  r  rv   )r  r  __tracebackhide__error_templater  doc_urlr  action_r  	category_modulelineno_actionr   categoryr   exception_textlinenos                     rK   parse_warning_filterr$  P  s    	 	 	 	
 
N IIcNNE
5zzA~~X 	 !%jj 
 3:  
 
 ..U.;;<<<
e**q..R e**q..3M3Mu3M3M3M0GWiH)1)<W)E)E  H H H..SVV.<<==4GHP";I"F"F P P P -//!)))99..^.DDEE4OP  %6 %)G$$ +& +6""U* 
	\\Fzz !5666  	 	 	%%,Ng,N,N1,N,N%OO 	
 7Hff44s=   C) )D.81D))D.2E AF$G8 8
H1*H,,H1r!  c                 4   d}| st           S d| vrddl}| }n,|                     d          \  }}}t          |dd|g          }t	          ||          }t          |t                     st          | d          t          t          t                    |          S )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)	r  builtins
rpartitionr  r   
issubclassr"   r	   r   )r!  r  r   klassr  r1  cats          rK   r  r    s    
  
(#..s335vtTE733
!U

Cc7## =C;;;<<<Ws###rJ   r  r  c                     | D ]}t          j        t          |d             |D ]}t          j        t          |d             dS )z8Applies pytest-configured filters to the warnings moduleF)r  TN)r   r  r$  )r  r  r  s      rK   r  r    sp      J J!5c%!H!H!HIII I I!5c$!G!G!GHHHI IrJ   )NN)rP   r   rR   )rB   r  collections.abcr  r?  r  r  	functoolsr   rb  importlib.metadatar_   r   ra   pathlibr   r  ro  rx   textwrapr   r=  r   typingr   r   r	   r
   r   r   r   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._ior'   _pytest.deprecated_pytest.hookspec_pytest.outcomesr(   r)   _pytest.pathlibr*   r+   r,   r-   r.   r/   _pytest.stashr0   _pytest.warning_typesr1   r2   r  r3   r5   _pytest._code.coder6   _pytest.terminalr7   r  r  r  r  IntEnumr:   r[   rM   _codeTracebackEntryrD  rc   r\   r  r   r   r   r   r   r  r   r  r  rv  r   r   rq   r   r  r   r>  r  r  r  r  r   r  r  r  r  r$  r  r  rI   rJ   rK   <module>rD     s"   @ @                        				       				  



                                                                                                                                        ! ! ! ! ! !       ! ! ! ! ! !                   & & & & & & . . . . . . 0 0 0 0 0 0 & & & & & &           ' ' ' ' ' ' * * * * * * & & & & & &         ! ! ! ! ! ! $ $ $ $ $ $ ( ( ( ( ( ( ' ' ' ' ' ' ' ' ' ' ' ' & & & & & & 0 0 0 0 0 0 ' ' ' ' ' '       5 5 5 5 5 5 3 3 3 3 3 3  2$$$$$$""""""222222111111  >(##>(##     t|   ,O O O O OI O O OX='X	X X X X <@=A6> 6>
5c$667
86>huS-%789:6> 3=6> 6> 6> 6>rc    $       s S S     c c       	
             !" #$ %& '( )* +, -. /0 12 34 56 7 < #o&&   J      ) * * * !%=A 
49
huS-%789:    2& & & & <@=A 
5c$667
8huS-%789:    @ $     S#X 
#t)_	   @ _( _( _( _( _(- _( _( _(Du'hsm;<	#Y   ,       
 
>CHSM >Chsm >C >C >C >CB L L L L L L L L^d     .2 "6*   09C 9D 9 9 9 9$ 2D5	D5D5
!3WsC?@D5 D5 D5 D5N$ $W $ $ $ $,
ISM
I4<SM
I	
I 
I 
I 
I 
I 
IrJ   