
    F-Ph                   D   d 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m	Z	 ddlm
Z
 ddlZddlZddlZddlZdd	lmZ ddlZddlZddlZddlZddlZddlZddl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&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/m0Z0 ddl/m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6Z4ddl6m7Z7 ddl6m8Z8 dd l9m:Z: dd!l;m<Z< dd"l=m>Z> dd#l=m?Z? ddl@Z4ddlAZ4dd$lBmCZC dd%lBmDZD dd&lEmFZF dd'lEmGZG dd(lEmHZH dd)lEmIZI dd*lEmJZJ dd+lEmKZK dd,lLmMZM dd-lNmOZO dd.lNmPZP e%rdd/lQmRZR dd0lSmTZT dd1lUmVZV eWZX	  e(d2          ZY e*d2          ZZe" G d3 d4ej[                              Z\ G d5 d6e]          Z^dd;Z_	 	 dddAZ`ddCZa G dD dE          ZbddIZcddJZddKZeg ee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 Zfh efdedfZg	 	 dddiZhddkZi	 	 dddlZjddnZkdduZle" G dv dje,                      ZmddzZn G d{ d|          Zo eo            ZpddZqe" G d dh                      ZrddZs	 dddZtddZu ed          dd            ZvddZwddZxdS )z:Command line options, ini-file and conftest.py processing.    )annotationsN)Callable)	Generator)Iterable)Iterator)Sequence)	lru_cache)dedent)FunctionType)Any)cast)Final)final)IO)TextIO)TYPE_CHECKING)HookimplMarker)HookimplOpts)HookspecMarker)HookspecOpts)PluginManager   )PathAwareHookProxy)	PrintHelp)
UsageError)determine_setup)__version__)ExceptionInfo)filter_traceback)TracebackStyle)TerminalWriter)ArgumentParser)fail)Skipped)absolutepath)bestrelpath)import_path)
ImportMode)resolve_package_path)safe_exists)Stash)PytestConfigWarning)warn_explicit_for)AssertionRewritingHook)Cache)TerminalReporterpytestc                  *    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     W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/config/__init__.pyr5   r5   [   s;          
BLKNKrE   r5   c                      e Zd ZddZdd	Zd
S )ConftestImportFailurepathpathlib.Pathcause	ExceptionreturnNonec               "    || _         || _        d S N)rI   rK   )selfrI   rK   s      rF   __init__zConftestImportFailure.__init__s   s     	


rE   strc                Z    t          | j                  j         d| j         d| j         dS )N: z (from ))typerK   r:   rI   rQ   s    rF   __str__zConftestImportFailure.__str__|   s2    tz""+NNtzNN$)NNNNrE   N)rI   rJ   rK   rL   rM   rN   )rM   rS   )r:   r;   r<   rR   rY   rD   rE   rF   rH   rH   r   sB           O O O O O OrE   rH   entry_pytest._code.TracebackEntryrM   boolc                    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   rS   rI   splitossep)rZ   s    rF   ,filter_traceback_for_conftest_import_failurerb      s6     E""W{#ej//:O:OPRPV:W:W'WWrE   args#list[str] | os.PathLike[str] | Noneplugins$Sequence[str | _PluggyPlugin] | Noneint | ExitCodec                   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: 
)r`   environgetr   _prepareconfighookpytest_cmdline_mainr5   _ensure_unconfigurepop
ValueErrorrH   r   from_exceptionrK   r!   sysstderrlinerI   	tracebackfilterrb   getreprexconlyrS   
splitlinesrstriprB   r   rc   )rc   re   old_pytest_versionrk   reteexc_infotwexc_reprformatted_tbr|   msgs               rF   mainr      sh    (899&>'2
#$	-#D'22F$-&,k&E&EV&E&T&T#C== **,,, %JNN+T2222+=BJ'(( "   JJ**,,, %JNN+T2222+=BJ'(( **,,,,1 % 	( 	( 	($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'((E	(2  $ $ $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=intc                 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   rz   stdoutflushBrokenPipeErrorr`   opendevnullO_WRONLYdup2fileno)coder   s     rF   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;   r<   staticmethodr   rD   rE   rF   r   r      s        <DDDrE   r   rI   rS   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: r`   rI   isdirr   rI   r   s     rF   filename_argr      s<     
w}}T IGGGGGHHHKrE   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     rF   directory_argr      s<     7== JGHH$HHIIIKrE   )markr   runnerfixtures
helpconfigpythonterminal	debuggingunittestcaptureskipping
legacypathtmpdirmonkeypatchrecwarnpastebin	assertionjunitxmldoctestcacheproviderfreeze_support	setuponly	setupplanstepwiseunraisableexceptionthreadexceptionwarningsloggingreportsfaulthandlerpytesterpytester_assertionslist[str] | NoneConfigc           	     &   t                      }t          |t                              | pd|t          j                                                            }| |                    | d           t          D ]}|                    |           |S )NrD   rc   re   dirinvocation_paramsTexclude_only)	PytestPluginManagerr   InvocationParamspathlibPathcwdconsider_preparsedefault_pluginsimport_plugin)rc   re   pluginmanagerrk   specs        rF   
get_configr     s    
 ())M 11  "" 2 
 
  F ''4'@@@ * *##D))))MrE   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   rD   rE   rF   get_plugin_managerr   4  s     <<%%rE   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   rc   )rz   argv
isinstancer`   PathLikefspathlist	TypeErrorformatrW   r   r   rS   consider_pluginargregisterrt   pytest_cmdline_parseBaseExceptionrv   )rc   re   r   rk   r   plugins         rF   rs   rs   ?  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,rJ   c                <    |                                  r| j        S | S )z<Get the directory of a path - itself if already a directory.)is_fileparent)rI   s    rF   _get_directoryr   _  s    ||~~ {rE   methodr   	hook_type	opt_namestuple[str, ...]dict[str, bool]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 rD   name).0ms     rF   	<setcomp>z)_get_legacy_hook_marks.<locals>.<setcomp>o  s    OOOQVOOOrE   
pytestmark=Tz=TrueF, )rW   fullname	hook_opts)r   inspect	isroutinegetattrAttributeErrorappendjoin_pytest
deprecatedHOOK_LEGACY_MARKINGr   r<   r/   r   r   )
r   r   r   known_marks	must_warnoptsopt_nameopt_attrr   messages
             rF   _get_legacy_hook_marksr	  g  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>>>KrE   c                       e Zd ZdZdD fdZdE fd
ZdF fdZdGdH fdZdIdZdJdZ	dKdZ
dLd"ZdMd$ZdNd'ZdOd(ZdPd*ZdQd,ZdRd/ZdSd1Zd2d3dTd6ZdUd8ZdVd;ZdDd<ZdWd=ZdXd@ZdYdZdCZ xZS )[r   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.
    rM   rN   c                   ddl m} ddl m} t                                          d           t                      | _        i | _        d | _        d| _	         t          d          t                    | _        g | _        |                     t          j                   |                     |            t"          j                            d          rt(          j        }t-          |dd	          }	 t/          t#          j        |                                          |j        d
|          }n# t6          $ r Y nw xY w| j        j                            |j                   |                                    |            | _!        d| _"        d S )Nr   )DummyRewriteHook)RewriteHookr3   F   PYTEST_DEBUGencodingutf8r   )mode	bufferingr  )#_pytest.assertionr  r  superrR   set_conftest_plugins_dirpath2confmods_confcutdir_noconftestr	   r   skipped_pluginsadd_hookspecsr   hookspecr   r`   rq   rr   rz   r{   r   r   dupr   r  rL   traceroot	setwriterwriteenable_tracingrewrite_hook_configured)rQ   r  r  errr  	__class__s        rF   rR   zPytestPluginManager.__init__  s   666666111111""" 9< NP04 
 -inn^<< 797+,,,d:>>.)) 	":C#CV<<HF3::<<((%	      JO%%ci000!!! *:)9);); s   1<D. .
D;:D;r   _PluggyPluginr   rS   HookimplOpts | Nonec                &   |                     d          sdS |dk    rdS t                                          ||          }||S t          ||          }t	          j        |          sdS t          |dd          }t          t          |          S ):meta private:pytest_Npytest_pluginsimpl)tryfirsttrylastoptionalhookhookwrapper)	
startswithr  parse_hookimpl_optsr   r   r   r	  r   r   )rQ   r   r   r  r   legacyr'  s         rF   r4  z'PytestPluginManager.parse_hookimpl_opts  s     y)) 	4###4ww**6488K&& (( 	4'FR
 
 L&)))rE   HookspecOpts | Nonec                    t                                          ||          }|Kt          ||          }|                    d          r&t	          |dd          }t          t          |          }|S )r+  Nr,  r   )firstresulthistoric)r  parse_hookspec_optsr   r3  r	  r   r   )rQ   module_or_classr   r  r   r5  r'  s         rF   r:  z'PytestPluginManager.parse_hookspec_opts  sq    ww**?DAA<_d33Fy)) 2/F$?  L&11rE   N
str | Nonec           
        |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   warnr.   r   replacer  r   rt   pytest_plugin_registeredcall_historicdictr   types
ModuleTypeconsider_module)rQ   r   r   r@  r'  s       rF   r   zPytestPluginManager.register  s    7%AAAM#??EvS#..@ @    4gg&&vt44"I.<<! +    =    &%"233 -$$V,,,rE   c                0    |                      |          }|S rP   )
get_plugin)rQ   r   r   s      rF   	getpluginzPytestPluginManager.getplugin  s    '+t'<'<rE   r\   c                F    t          |                     |                    S )z:Return whether a plugin with the given name is registered.)r\   rN  )rQ   r   s     rF   	haspluginzPytestPluginManager.hasplugin
  s    DOOD))***rE   rk   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%  )rQ   rk   s     rF   pytest_configurez$PytestPluginManager.pytest_configure  sX     	G	
 	
 	
 	F	
 	
 	
  rE   rc   Sequence[str | pathlib.Path]pyargs
noconftestrootpathrJ   
confcutdirpathlib.Path | Noneinvocation_dir
importmodeImportMode | str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.
        NF::r_  T)r'   r  r  _using_pyargsrS   findr,   _try_load_conftest)rQ   rc   rW  rX  rY  rZ  r\  r]  r_  foundanchorinitial_pathrI   ianchors                 rF   _set_initial_conftestsz*PytestPluginManager._set_initial_conftests#  s   ( :DML*4555 	 &#  	# 	#L|$$D		$ABwwBQBx!.4"788F 6"" #''0K	 (    # 	##,G	 $     	 	rE   rI   c                0    | j         dS || j         j        vS )z:Whether to consider the given path to load conftests from.NT)r  parentsrQ   rI   s     rF   _is_in_confcutdirz%PytestPluginManager._is_in_confcutdirV  s#    #4 4+333rE   rj  str | ImportModec                   |                      ||||           |                                rE|                    d          D ]1}|                                r|                      ||||           0d S d S )Nrc  ztest*)_loadconftestmodulesis_dirglob)rQ   rj  r]  rY  r_  xs         rF   rf  z&PytestPluginManager._try_load_confteste  s     	!!(C	 	" 	
 	
 	
 ==?? 	[[))  88:: --" 4O	 .   	 	 rE   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.pyrc  )	r  r   r  reversedrm  ro  r   _importconftestr   )
rQ   rI   r]  rY  r_  	directoryclistr   conftestpathmods
             rF   rr  z(PytestPluginManager._loadconftestmodules~  s      	F''--	 ...F	>I,=>>?? 
	& 
	&F%%f-- 	&%5'')) &..$" 4O	 /  C LL%%%,1y)))rE   Sequence[types.ModuleType]c                b    |                      |          }| j                            |d          S )NrD   )r   r  rr   )rQ   rI   ry  s      rF   _getconftestmodulesz'PytestPluginManager._getconftestmodules  s.    ''--	%)))R888rE   tuple[types.ModuleType, Any]c                    |                      |          }t          |          D ]&}	 |t          ||          fc S # t          $ r Y #w xY wt	          |          rP   )r  rw  r   r   KeyError)rQ   r   rI   modulesr|  s        rF   _rget_with_confmodz&PytestPluginManager._rget_with_confmod  sz    
 **400G$$ 	 	CGC......!   tnns   <
A	A	r{  types.ModuleTypec          
        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   r_  )rK   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)rS   rN  r   rJ  rK  r+   rz   r  stemr  r)   rL   __traceback__rH   _check_non_top_pytest_pluginsr  addr   r  itemsrm  AssertionError__file__r   r  consider_conftest)rQ   r{  r]  rY  r_  conftestpath_plugin_nameexistingpkgpathr|  r   dirpathrI   modss                rF   rx  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r|  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%  rd  r%   r   r  )rQ   r|  r{  r   s       rF   r  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rE   Fr   Sequence[str]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-pNr6   no:)lenr   rS   
IndexErrorr3  stripr   )rQ   rc   r   ri  noptpargs          rF   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| d          |dk    r*|                     d           |                     d           |                     |           |                     d	          s|                     d	|z              dS dS |}|                     |           |                     d	          s|                     d	|z              |                     |d
           dS )r+  r  r7   Nzplugin z cannot be disabledr   r   pytest_stepwiser,  T)consider_entry_points)r3  essential_pluginsr   set_blockedunblockr   )rQ   r  r   s      rF   r   z&PytestPluginManager.consider_pluginarg  s4   >>%   	@qrr7D((( !D4!D!D!DEEE &&  ,,,  !2333T"""??9-- 3  T!1222223 3 DLL??9-- /Y-...s$?????rE   conftestmoduler  c                4    |                      ||           dS )r+  r   N)r   )rQ   r  r  s      rF   r  z%PytestPluginManager.consider_conftest.  s!     	n+<=====rE   c                j    |                      t          j                            d                     dS )r+  PYTEST_PLUGINSN)_import_plugin_specsr`   rq   rr   rX   s    rF   consider_envz PytestPluginManager.consider_env4  s+    !!"*..1A"B"BCCCCCrE   c                N    |                      t          |dg                      dS )r+  r-  N)r  r   )rQ   r|  s     rF   rL  z#PytestPluginManager.consider_module8  s)    !!'#/?"D"DEEEEErE   r   -None | types.ModuleType | str | Sequence[str]c                X    t          |          }|D ]}|                     |           d S rP   )_get_plugin_specs_as_listr   )rQ   r   re   import_specs       rF   r  z(PytestPluginManager._import_plugin_specs<  sA     ,D11" 	, 	,K{++++	, 	,rE   modnamer  c                   t          |t                    sJ d|            |                     |          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 Nz_pytest.pytest11r   zError importing plugin "z": r    )r   rS   
is_blockedrN  builtin_pluginsr$  mark_rewriteload_setuptools_entrypoints
__import__rz   r  r   ImportErrorrc   with_tracebackr  r&   r  r   r   )rQ   r  r  
importspecloadedr|  r   s          rF   r   z!PytestPluginManager.import_pluginC  s    '3'' 	
 	
<<<	
 	
 	
 ??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rM   rN   )r   r(  r   rS   rM   r)  )r   rS   rM   r6  rP   )r   r(  r   r<  rM   r<  r   rS   )r   rS   rM   r\   )rk   r   rM   rN   )rc   rV  rW  r\   rX  r\   rY  rJ   rZ  r[  r\  rJ   r]  r^  r_  r\   rM   rN   )rI   rJ   rM   r\   )
rj  rJ   r]  rp  rY  rJ   r_  r\   rM   rN   )
rI   rJ   r]  rp  rY  rJ   r_  r\   rM   rN   )rI   rJ   rM   r}  )r   rS   rI   rJ   rM   r  )
r{  rJ   r]  rp  rY  rJ   r_  r\   rM   r  )r|  r  r{  rJ   rM   rN   )rc   r  r   r\   rM   rN   )r  rS   rM   rN   )r  r  r  rS   rM   rN   )r|  r  rM   rN   )r   r  rM   rN   )F)r  rS   r  r\   rM   rN   )r:   r;   r<   r=   rR   r4  r:  r   rO  rQ  rU  rk  ro  rf  rr  r  r  rx  r  r   r   r  r  rL  r  r   __classcell__)r'  s   @rF   r   r     s7        2! 2! 2! 2! 2! 2!h* * * * * *6
 
 
 
 
 
      2   
+ + + +       *1 1 1 1f4 4 4 4   22 2 2 2@9 9 9 9   3 3 3 3jL L L L6 <A. . . . . .2@ @ @ @.> > > >D D D DF F F F, , , ,#( #( #( #( #( #( #( #( #(rE   specsr  	list[str]c                   | 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:Parse a plugins specification into a list of plugin names.N,zWPlugins may be specified as a sequence or a ','-separated string of plugin names. Got: )
r   rJ  rK  rS   r_   collectionsabcr   r   r   )r  s    rF   r  r  i  s    
 }	%)** 	% 1#(0u{{3b0%122 E{{
kbgkk  rE   c                      e Zd Zd ZdS )Notsetc                    dS )Nz<NOTSET>rD   rX   s    rF   __repr__zNotset.__repr__  s    zrE   N)r:   r;   r<   r  rD   rE   rF   r  r  ~  s#            rE   r  package_filesIterable[str]Iterator[str]c              #  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countr`   rI   splitextr3  dirnamer_   r   r   _iter_rewritable_modules)r  	seen_somefnis_simple_module
is_packagemodule_namer>  package_namenew_package_filespartsnew_fns              rF   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rE   c                     e Zd ZU dZe ej        d           G d d                                  Z G d dej	                  Z
ded	<   d
ddzdZed{d            Zed|d            Zd}dZd~dZd~dZddZdd Z	 ddd%Zdd(Zedd)            Zdd,Z ed-          dd/            Zdd1Zdd2Zdd7Zd~d8Zd~d9Z dd;Z!ddBZ"dddDZ# edE          ddG            Z$d~dHZ%d~dIZ&d~dJZ'ddLZ(ddMZ)dddNZ*ddSZ+ddVZ,ddXZ-dd\Z.dd]Z/dd`Z0ddbZ1e2dcfddfZ3dddgZ4dddhZ5diZ6djedk<   dlZ7djedm<   dnZ8djedo<   dddqZ9e:ddr            Z;e:ddv            Z<ddxZ=d~dyZ>d
S )r   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ded<   	 ded<   	 ded<   	 d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.
        r   rc   rf   re   rJ   r   r  rM   rN   c                   t                               | dt          |                     t                               | d|           t                               | d|           d S )Nrc   re   r   )object__setattr__tuple)rQ   rc   re   r   s       rF   rR   z Config.InvocationParams.__init__  sX     tVU4[[999tY888tUC00000rE   N)rc   r  re   rf   r   rJ   rM   rN   )r:   r;   r<   r=   __annotations__rR   rD   rE   rF   r   r    sc         	 	 	J5555-[		1 		1 		1 		1 		1 		1rE   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;   r<   r=   enumautoARGSINVOCATION_DIRINCOVATION_DIR	TESTPATHSrD   rE   rF   
ArgsSourcer    sF        	 	 ty{{"'DIKK			rE   r  r1   cacheNr   r   r   r   InvocationParams | NonerM   rN   c               6   ddl m} ddl m} |4|                     dd t          j                                                  }t          j                    | _	        	 || _
        	 |} |d| d| d| j        d	
          | _        || _        	 t                      | _        	 | j        | _        | j        j        j                            d          | _        t)          | j        j                  | _        i | _        d| _        i | _        t3          j                    | _        | j                            | d           d| _        | j        j                            tA          | j        | j                             tB          j"        j#        | _$        g | _%        d S )Nr   )FILE_OR_DIRr#   rD   r   z%(prog)s [options] [z] [z] [...]T)usage
processopt	_ispytestrk   pytestconfigF)parserr   rB  )&
argparsingr  r$   r   r   r   r   argparse	Namespaceoptionr   _processopt_parserr   r-   stash_storer  r   rr   r   rt   	_inicache_override_ini	_opt2dest
contextlib	ExitStack_cleanup_stackr   r%  pytest_addoptionrH  rI  r   r  r  args_sourcerc   )rQ   r   r   r  r$   _as         rF   rR   zConfig.__init__  s    	,+++++&&&&&&$ $ 5 57<+;+;+=+= !6 ! ! (**	
 "3	
 v;;;;;;'
 
 

 +	
 WW
	 j'-266x@@
&89K9P&Q&Q	)+,.)+(244##D.999 	"00t|4;MNNN 	1 	
 	
 	
 ",1!			rE   rJ   c                    | j         S )znThe path to the :ref:`rootdir <rootdir>`.

        :type: pathlib.Path

        .. versionadded:: 6.1
        )	_rootpathrX   s    rF   rY  zConfig.rootpathD  s     ~rE   r[  c                    | j         S )zXThe path to the :ref:`configfile <configfiles>`.

        .. versionadded:: 6.1
        )_inipathrX   s    rF   inipathzConfig.inipathN  s     }rE   funcCallable[[], None]c                :    | j                             |           dS )zAdd a function to be called when the config object gets out of
        use (usually coinciding with pytest_unconfigure).
        N)r
  callback)rQ   r  s     rF   add_cleanupzConfig.add_cleanupV  s!     	$$T*****rE   c                    | j         rJ d| _         | j        j                            t	          |                      d S )NTrj   rB  )r%  rt   rU  rH  rI  rX   s    rF   _do_configurezConfig._do_configure\  sF    ####	"00D8I8I8I0JJJJJrE   c                   	 | j         rKd| _         	 | j                            |            g | j        j        _        n# g | j        j        _        w xY w	 | j                                         t          j                    | _        d S # t          j                    | _        w xY w# 	 | j                                         t          j                    | _        n# t          j                    | _        w xY ww xY w)NFrj   )	r%  rt   pytest_unconfigurerU  _call_historyr
  closer  r	  rX   s    rF   rv   zConfig._ensure_unconfigurea  s	   	= B#( BI000===?ADI.<<rDI.<AAAA=#))+++&0&:&<&<###j&:&<&<#<<<<=#))+++&0&:&<&<##j&:&<&<#<<<<<<<<sC   B% > B% AB% B B"%C7'C C7C33C7r!   c                L    | j                             d          }|J |j        S )Nterminalreporter)r   rN  _tw)rQ   r  s     rF   get_terminal_writerzConfig.get_terminal_writero  s5    484F4Q4Q5
 5
  +++##rE   rc   r  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_helprz   r   r"  )rQ   r   rc   r$  s       rF   r   zConfig.pytest_cmdline_parsev  s    	JJt 	 	 	 t{Iu55 
9L9L::::::D!!!!VU337?47G7G4SW<<''))44666
  Q   !	$ s
    B B8excinfoExceptionInfo[BaseException]r   argparse.Namespace | Nonec                   |rt          |dd          rd}nd}|                    dt          |dd          |          }| j                            ||          }t	          |          sft          |                              d	          D ]E}t          j        	                    d
| d	           t          j        
                                 Dd S d S )N	fulltraceFlongnativeT
showlocals)funcargsr1  rn   )excreprr*  rp   zINTERNALERROR> )r   r   rt   pytest_internalerroranyrS   r_   rz   r{   r"  r   )rQ   r*  r   rn   r3  resr|   s          rF   notify_exceptionzConfig.notify_exception  s    
  	gfk599 	$*EEE//gflE&J&JRW " 
 
 i,,Wg,NN3xx 	#G**400 # #
  !;4!;!;!;<<<
  """"	# 	## #rE   nodeidrS   c                    | j         j        | j        k    rS|                    d          ^}}| j        |z  }t	          | j         j        |          }d                    |g|          }|S )Nra  )r   r   rY  r_   r(   r   )rQ   r8  base_path_partnodeid_partfullpathrelative_paths         rF   cwd_relative_nodeidzConfig.cwd_relative_nodeid  sj    !%66+1<<+=+=(N[}~5H'(>(BHMMMYY<<==FrE   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_dictrc   rk   ru  s        rF   fromdictargszConfig.fromdictargs  ss     D!!%%k222T5)))& 	7 	7A 33A6666rE   r  r"   c                    |j         |j        z   D ]}|j        | j        |<   t	          |d          r<t	          | j        |j                  s$t          | j        |j        |j                   d S d S d S )Ndefault)_short_opts
_long_optsdestr  r  r   setattrrH  )rQ   r  r   s      rF   r  zConfig._processopt  s    Ocn4 	, 	,D#&8DN4  3	"" 	<4;11 <SXs{;;;;;	< 	<< <rE   )r0  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rc   rW  rO  r\  rY  rE  r_  )rc   rW  rX  rY  rZ  r\  r]  r_  )_decide_argsknown_args_namespacefile_or_dirrW  getinir   r   rY  r   rk  rX  rZ  r]  )rQ   rM  rc   r  s       rF   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 	
 	
 	
 	
 	
rE   r  c                   | 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                             dddg            |j        pd| _        d S )N	namespace)inifilerc   rootdir_cmd_argr\  rootdirrY  rA  zExtra command line optionsrc   
minversionz!Minimally required pytest version
pythonpathpathszAdd paths to sys.path)rW   r%  rH  required_pluginsz.Plugins that must be present for pytest to run)rW   rH  rD   )r  parse_known_and_unknown_argscopyr   r   inifilenamerS  r[  r   r   r  r  inicfgrS   rY  
extra_infor  addinioverride_inir  )rQ   rc   nsunknown_argsrY  r  rc  s          rF   _initinizConfig._initini  s^   <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w-Db 	 	
 	
 	
 	<	 	 	
 	
 	
  _2rE   c                   | j                             |          \  }}t          |dd          }t          |dd          p+t          t          j                            d                    }|dk    rHd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disable_plugin_autoloadFPYTEST_DISABLE_PLUGIN_AUTOLOADrewriter   N)r  r`  r   r\   r`   rq   rr   r  r   install_importhook_mark_plugins_for_rewriteSystemError_warn_about_missing_assertion)rQ   rc   rg  rh  r  disable_autoloadr   rt   s           rF   _consider_importhookzConfig._consider_importhook  s      <DDTJJLr<11"2'@%HH 
DJNN;<<M
 M
 9$$$$G(;;DAA ..t5EFFFF     	**400000s   7B( (B76B7rt   r0   rt  r\   c                    || j         _        |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.Nc              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     rF   	<genexpr>z=Config._mark_plugins_for_rewrite.<locals>.<genexpr>.<genexpr>  s)      FFb28z)FFFFFFrE   N)r5  entry_pointsfilesrS   )r   distfiles      rF   r{  z3Config._mark_plugins_for_rewrite.<locals>.<genexpr>  s~       
 
FFD4EFFFFF
 
(b	
 
  II
 
 
 
 
 
 
rE   )r   r$  r^   metadatadistributionsr  r  )rQ   rt   rt  r  r   s        rF   rq  z Config._mark_plugins_for_rewrite  s     +/' 	 F
 
!*88::
 
 
 -];; 	$ 	$Dd####	$ 	$rE   c                    t          |                     d                    D ]/}t          j                            dt          |                     0|                     | j                   d S )Nr]  r   )rw  rT  rz   rI   insertrS   r  _unconfigure_python_pathrn  s     rF   _configure_python_pathzConfig._configure_python_path$  sa    T[[6677 	* 	*DHOOAs4yy))))677777rE   c                    |                      d          D ]>}t          |          }|t          j        v rt          j                            |           ?d S )Nr]  )rT  rS   rz   rI   remove)rQ   rI   path_strs      rF   r  zConfig._unconfigure_python_path*  sT    KK-- 	* 	*D4yyH38##)))	* 	*rE   viac                    || j         _        	 | j                             |t          j        | j                             | j         `n# | j         `w xY w|S )zValidate known args.rW  )r  _config_source_hintr`  ra  r   )rQ   rc   r  s      rF   _validate_argszConfig._validate_args0  sg    +.(	1L55	$+ 6 6 6    0000000s   3A	 		ArW  rO  r\  rY  rE  tuple[list[str], ArgsSource]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.r7   
stacklevel)r   r  r  r  extendsortedrt  iglobissue_config_time_warningr.   r  rS   )rQ   rc   rW  rO  r\  rY  rE  sourceresultrI   warning_texts              rF   rQ  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~rE   rA  c                   |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        j        s| j                            d
           | j                                         | j	        
                    |t          j        | j                            | _        |                                  |                                  | j        j        A| j        t5          | j        j                  }nt5          | j                  }|| j        _        	 | j                            | || j	                   d S # t>          $ rQ}| j        j         s| j        j!        r-| "                    tG          d|j$                   d           n Y d }~d S d }~ww xY w)NPYTEST_ADDOPTSr  zvia PYTEST_ADDOPTSrA  zvia addopts configrW  Fr   rn  r  )rM  rc   r  z"could not load initial conftests: r6   r  )%r`   rq   rr   r  r  shlexr_   ri  rT  r  parse_known_argsra  r   rR  _checkversionru  r  r   r   rm  r  r  _validate_plugins_warn_about_skipped_pluginsrZ  r  rS   r   rY  rt   rU  rH   r%  r#  r  r.   rI   )rQ   rc   rA  env_addoptsrZ  r   s         rF   	_preparsezConfig._preparsei  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
?@@	G-E	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+ +
K5AKK)wrapperGenerator[None, object, object]c              #  j   K   	 d V |                                   S # |                                   w xY wrP   )_validate_config_optionsrX   s    rF   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|                    | j         d           ||           ||j	                  k    r*|                    | j         d| d|j	         d          d S d S )Nr   r\  Versionz%: 'minversion' must be a single valuez: 'minversion' requires pytest-z, actual pytest-')
r3   rc  rr   packaging.versionr  r   rS   r   r  r   )rQ   r3   minverr  s       rF   r  zConfig._checkversion  s    t44 	111111fc** ''|JJJ   wv);!<!<<<''|qqFqq\b\nqqq  	 	 =<rE   c                    t          |                                           D ]}|                     d| d           d S )NzUnknown config option: rp   )r  _get_unknown_ini_keys_warn_or_fail_if_strict)rQ   keys     rF   r  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rE   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 rD   )project_namer#  )r   r>  r~  s      rF   
<dictcomp>z,Config._validate_plugins.<locals>.<dictcomp>  s#    WWW4D-t|WWWrE   T)prereleaseszMissing required plugins: {}r   )r  rT  packaging.requirementsr  r  r  r  r   list_plugin_distinfor   r   	specifiercontainsr   r   r   )
rQ   r_  r  r  r  plugin_infoplugin_dist_infomissing_pluginsrequired_pluginreqs
             rF   r  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 )Nr7   r  )rR  strict_configr   r  r.   )rQ   r  s     rF   r  zConfig._warn_or_fail_if_strict  sG    $2 	&W%%%&&':7'C'CPQ&RRRRRrE   c                B    | j         j        fd| j        D             S )Nc                    g | ]}|v|	S rD   rD   )r   r   parser_inicfgs     rF   
<listcomp>z0Config._get_unknown_ini_keys.<locals>.<listcomp>  s#    JJJM0I0I0I0I0IrE   )r  _inidictrc  )rQ   r  s    @rF   r  zConfig._get_unknown_ini_keys  s)    -JJJJJJJJrE   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   rB  r@  TrW  rO  rP  )rc   rt   pytest_addhooksrH  rI  r   r  r  after_preparseparse_setoptionr   rQ  rR  rW  rT  r   r   rY  r  r   )rQ   rc   rA  s      rF   r&  zConfig.parse  s   yBH  		!//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warningWarningr  r   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alwaysr  r   r   rk   r  )warning_messagewhenr8  locationrB  )r   r  rR  pythonwarningsrT  r   catch_warningssimplefilterrW   apply_warning_filtersrE  rz   	_getframef_codeco_filenamef_linenoco_namert   pytest_warning_recordedrH  rI  )rQ   r  r  cmdline_filtersconfig_filtersrecordsframer  s           rF   r  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   r|   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)rT  r   r   r   )rQ   r   r|   ru  s       rF   rT  zConfig.addinivalue_line+  s>     KK!T"""""	rE   r   c                    	 | j         |         S # t          $ r$ |                     |          x| j         |<   }|cY S w xY w)al  Return configuration value from an :ref:`ini file <configfiles>`.

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

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

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

        If the specified name hasn't been registered through a prior
        :func:`parser.addini <pytest.Parser.addini>` call (usually from a
        plugin), a ValueError is raised.
        )r  r  _getini)rQ   r   vals      rF   rT  zConfig.getini3  sU    <	>$'' 	 	 	)-d););;DN4 3JJJ	s    +==rW   valuer  c                6    d| d| d|}t          |          )NzOption z  has unknown configuration type z with value )rx   )rQ   r   rW   r  r   s        rF   _getini_unknown_typezConfig._getini_unknown_typeY  s0    WdWWDWWeWW 	 oorE   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 |dk    r:t          |t                    st#          d| d|          d t%          |          S |dk    r:t          |t                    st#          d| d|          d t'          |          S ||S |                     |||          S )Nzunknown configuration value: r^  c                    g | ]}|z  S rD   rD   )r   ru  dps     rF   r  z"Config._getini.<locals>.<listcomp>  s    111qBF111rE   rc   linelistc                    g | ]}||S rD   rD   )r   ts     rF   r  z"Config._getini.<locals>.<listcomp>  s    TTTaRSTTTTrE   c                *    |                                  S rP   r  )ru  s    rF   <lambda>z Config._getini.<locals>.<lambda>  s     rE   rp   r\   stringr   z"Expected an int string for option z of type integer, but got: floatz#Expected a float string for option z of type float, but got: )r  r  r  rx   _get_override_ini_valuerc  r  r   r   r   r   rS   r  r_   map
_strtoboolr  r   r   r  r  )
rQ   r   descriptionrW   rH  r   override_valuer  input_valuesr  s
            @rF   r  zConfig._getini_  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U]]eS)) cccZ_cc  u::W__eS)) b$bbY^bb  <<\L,,T4???s"    
<7<A% %A43A4rI   list[pathlib.Path] | Nonec                   	 | j                             ||          \  }}n# t          $ r Y d S w xY w|j        J t	          j        |j                  j        }g }|D ]x}t          |t          j	                  rt	          j        |          }n2|
                    dt          j                  }t          ||z            }|                    |           y|S )Nr  )r   r  r  r  r   r   r   r   r`   r   rF  ra   r'   r   )rQ   r   rI   r|  relrootsmodpathvaluesrelroots           rF   _getconftest_pathlistzConfig._getconftest_pathlist  s    	 .AA$MMMC 	 	 	44	|''',s|,,3%' 	# 	#G'2;// :!,w//!//#rv66&w'899MM'""""s   ! 
//r<  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_   rx   r   )rQ   r   r  
ini_configr  user_ini_valuer   s          rF   r  zConfig._get_override_ini_value  s     , 		+ 		+J+&0&6&6sA&>&>#^ $;;*E     Z*ZZZ  s   /
AAAFrH  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)as  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  rr   r   r   r   notsetr3   r  rx   )rQ   r   rH  r  r  r   r3   s          rF   	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  rQ   r   rI   s      rF   getvaluezConfig.getvalue  s    ~~d###rE   c                0    |                      |d          S )z-Deprecated, use getoption(skip=True) instead.T)r  r
  r  s      rF   getvalueorskipzConfig.getvalueorskip  s    ~~d~...rE   
assertionsr   VERBOSITY_ASSERTIONS
test_casesVERBOSITY_TEST_CASESr  _VERBOSITY_INI_DEFAULTverbosity_typec                &   |                      dd          }t          |t                    sJ ||S t                              |          }|| j        j        vr|S |                     |          }|t          j        k    r|S t          |          S )a5  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   )rH  )	r  r   r   r   _verbosity_ini_namer  r  rT  r  )rQ   r  global_levelini_namelevels        rF   get_verbosityzConfig.get_verbosity  s    > ~~i~;;,,,,,,!--n==4<000H%%F1115zzrE   c                    d|  S )N
verbosity_rD   )r  s    rF   r  zConfig._verbosity_ini_name  s    ,N,,,rE   r  r$   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%  rW   rH  N)re  r   r  r  )r  r  r%  s      rF   _add_verbosity_inizConfig._add_verbosity_ini  sF     	&&~661	 	 	
 	
 	
 	
 	
rE   r  c                    t                      s1|dk    rd}nd}|                     t          |          d           d S d S )Nrl  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?)
r7   r  )_assertion_supportedr  r.   )rQ   r  r  s      rF   rs  z$Config._warn_about_missing_assertion.  sp    #%% 	w( 3  **#L11 +     	 	rE   c           	     ~    | j         j        D ]/\  }}|                     t          d|d|           d           0d S )Nzskipped plugin rU   r6   r  )r   r  r  r.   )rQ   r  r   s      rF   r  z"Config._warn_about_skipped_pluginsC  sg     $ 2 B 	 	K**#$Lk$L$Ls$L$LMM +    	 	rE   )r   r   r   r  rM   rN   )rM   rJ   )rM   r[  )r  r  rM   rN   r  )rM   r!   )r   r   rc   r  rM   r   rP   )r*  r+  r   r,  rM   rN   )r8  rS   rM   rS   )rM   r   )r  r"   rM   rN   )rM  r   rM   rN   )rc   r  rM   rN   )rt   r0   rt  r\   rM   rN   )rc   r  r  rS   rM   r  )rc   r  rW  r\   rO  r  r\  rJ   rY  rJ   rE  r\   rM   r  )T)rc   r  rA  r\   rM   rN   )rM   r  )r  rS   rM   rN   )rM   r  )r  r  r  r   rM   rN   )r   rS   r|   rS   rM   rN   )r   rS   rM   r   )r   rS   rW   rS   r  r  r  )r   rS   rI   rJ   rM   r  )r   rS   rM   r<  )r   rS   rH  r   r  r\   )r  r<  rM   r   )r  rS   rM   rS   )r  r$   r  rS   r%  rS   rM   rN   )r  rS   rM   rN   )?r:   r;   r<   r=   r   dataclasses	dataclassr   r  Enumr  r  rR   propertyrY  r  r  r  rv   r!  r   r7  r>  classmethodrF  r  hookimplrU  ri  ru  rq  r  r  r  rQ  r  r  r  r  r  r  r  r&  r  rT  rT  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  rs  r  rD   rE   rF   r   r     s
          [$'''1 1 1 1 1 1 1 (' U1B         TY       LLL 6:	;" ;" ;" ;" ;" ;"z    X    X+ + + +K K K K
= = = =$ $ $ $   8 -1# # # # #$	 	 	 	    [< < < < Xd
 
 
 
43 3 3 381 1 1 10$ $ $ $.8 8 8 8* * * *
 
 
 
+ + + +Z: : : : :x Xd, , , ,   $L L L L   BS S S SK K K K    2! ! ! !F   " " " "L   >@ >@ >@ >@@   &   " 39u A A A A A2$ $ $ $ $/ / / / /
 #/....".....$*****, , , , ,\ - - - \- 
 
 
 \
"   *     rE   c                 *    	 J # t           $ r Y dS w xY w)NFT)r  rD   rE   rF   r!  r!  K  s.       tts    
rk   r  TextIO | Noner!   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)rk   r  r   s      rF   create_terminal_writerr1  T  s|     
T	"	"	"B}e##			$	$}#u,, 		%	-	-!IrE   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 )lowerrx   )r  s    rF   r  r  l  sJ     ))++C
222t	5	5	5u777888rE   2   )maxsizer  escape9tuple[warnings._ActionKind, str, type[Warning], str, int]c          	     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}	 t          j        |           t          j        |
           nF# t          j        $ r4}t          |                    d|j        d| 
                    dd}~ww xY w||||
|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}
        :r9   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 rP   r  )r   ss     rF   r{  z'parse_warning_filter.<locals>.<genexpr>  s*      3M3M!AGGII3M3M3M3M3M3MrE   Nr0  )rn   z\Zr   znumber is negativezinvalid lineno rU   zInvalid regex )r
   r_   r  r   r   r   r   
_getaction_OptionErrorrS   _resolve_warning_categoryrL   r   from_currentr   rer>  r   rx   compilerB  pattern)r  r>  __tracebackhide__error_templater  doc_urlrB  action_r  	category_modulelineno_actionr   categoryr   exception_textlinenos                     rF   parse_warning_filterrW  ~  sV    	 	 	 	
 
N IIcNNE
5zzA~~X 	 !%jj 
 3:  
 
 ..U.;;<<<
e**q..R e**q..3M3Mu3M3M3M0GWiH'/':7'C'C  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 	
 

7

68   !!(K(K(K(K(K!LL
 
	 7Hff44sU   C) )D.81D))D.2E AF$G8 8
H1*H,,H17(I   J#//JJ#rT  type[Warning]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   rW   )rT  rL  r   klassrQ  r>  cats          rF   rG  rG    s    
  
(#..s335vtTE733
!U

Cc7## =C;;;<<<Ws###rE   r  r  rN   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  rW  )r  r  r  s      rF   r  r    sp      J J!5c%!H!H!HIII I I!5c$!G!G!GHHHI IrE   )rZ   r[   rM   r\   )NN)rc   rd   re   rf   rM   rg   )rM   r   )rI   rS   r   rS   rM   rS   )rc   r   re   rf   rM   r   )rM   r   )rc   rd   re   rf   rM   r   )rI   rJ   rM   rJ   )r   r   r   rS   r   r   rM   r   )r  r  rM   r  )r  r  rM   r  )rM   r\   rP   )rk   r   r  r*  rM   r!   )r  rS   rM   r\   )r  rS   r>  r\   rM   r?  )rT  rS   rM   rX  )r  r  r  r  rM   rN   )yr=   
__future__r   r  collections.abcr  r   r   r   r   r   r  ra  r#  r  	functoolsr	   rt  importlib.metadatar^   r   r`   r   rI  r  rz   textwrapr
   rJ  r   typingr   r   r   r   r   r   r   r   pluggyr   r   r   r   r   compatr   
exceptionsr   r   	findpathsr   r   r   _pytest._coder   r   _pytest._code.coder    _pytest._ior!   _pytest.config.argparsingr"   r$   _pytest.deprecated_pytest.hookspec_pytest.outcomesr%   r&   _pytest.pathlibr'   r(   r)   r*   r+   r,   _pytest.stashr-   _pytest.warning_typesr.   r/   _pytest.assertion.rewriter0   _pytest.cacheproviderr1   _pytest.terminalr2   r  r(  r(  r  IntEnumr5   rL   rH   rb   r   r   r   r   r   r  r   r  r   r   rs   r   r	  r   r  r  r  r  r   r!  r1  r  rW  rG  r  rD   rE   rF   <module>ry     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@@@@@@++++++111111 >(##>(##     t|   ,O O O O OI O O OX X X X 15484> 4> 4> 4> 4>n   $                	
             !" #$ %& '( )* +, -. /0 12 34 5 :  "48    2& & & & 1548    @      @ ^( ^( ^( ^( ^(- ^( ^( ^(B   *       
 
>C >C >C >CB @ @ @ @ @ @ @ @F    +/    09 9 9 9$ 2K5 K5 K5 K5\$ $ $ $,
I 
I 
I 
I 
I 
IrE   