o
    Ú­j±ú  ã                   @   sþ  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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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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l0Z.ddl1m2Z2 ddl1m3Z3 ddl4m5Z5 dd l-m6Z6 dd!l-m7Z7 dd"l8m9Z9 dd#l:m;Z; dd$l:m<Z< dd%l=m>Z> dd&l=m?Z? dd'l@mAZA dd(l@mBZB dd)l@mCZC dd*l@mDZD dd+l@mEZE dd,l@mFZF dd-lGmHZH dd.lImJZJ dd/lImKZK e'�r_dd0lLmMZM dd1lNmOZO dd2lPmQZQ eRZS	 e*d3ƒZTe+d3ƒZUe;G d4d5„ d5ejVƒƒZWG d6d7„ d7eXƒZYd8e.jZj[d9e\fd:d;„Z]		džd<e!e(e e^ d=f  d>e!e"e(e^eSf   d9e(e_eWf fd?d@„Z`d9e_fdAdB„ZaG dCdD„ dDƒZbdEe^dFe^d9e^fdGdH„ZcdEe^dFe^d9e^fdIdJ„ZddKZeeedLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcgejfddk�rôdedfgng ¢dg‘R  ZgehegƒZiei jdh¡ ei jdi¡ 		džd<e!e e^  d>e!e"e(e^eSf   d9djfdkdl„ZkdŸdndo„Zl		džd<e!e(e e^ d=f  d>e!e"e(e^eSf   d9djfdpdq„ZmdEed9efdrds„Zndtedue^dve%e^dwf d9ee^e\f fdxdy„Zoe;G dzdm„ dme,ƒƒZpd{e(dejqe^e"e^ f d9e e^ fd|d}„Zrd~e^d9dfdd€„ZsG d�d‚„ d‚ƒZtetƒ Zudƒee^ d9ee^ fd„d…„Zve;G d†dj„ djƒƒZwd9e\fd‡dˆ„Zx	d d‰ewdŠe!e$ d9e9fd‹dŒ„Zyd�e^d9e\fdŽd�„Zzed�d‘�d’e^d“e\d9e%d”e^e&e{ e^e_f fd•d–„ƒZ|d—e^d9e&e{ fd˜d™„Z}dšee^ d›ee^ d9dfdœd�„Z~dS )¡z:Command line options, ini-file and conftest.py processing.é    N)Ú	lru_cache)ÚPath)Údedent)ÚFunctionType)ÚTracebackType)ÚAny)ÚCallable)Úcast)ÚDict)Ú	Generator)ÚIO)ÚIterable)ÚIterator)ÚList)ÚOptional)ÚSequence)ÚSet)ÚTextIO)ÚTuple)ÚType)ÚTYPE_CHECKING)ÚUnion)ÚHookimplMarker)ÚHookspecMarker)ÚPluginManageré   )Ú	PrintHelp)Ú
UsageError)Údetermine_setup)ÚExceptionInfo)Úfilter_traceback)ÚTerminalWriter)Úfinal)Úimportlib_metadata)Úfail)ÚSkipped)Úabsolutepath)Úbestrelpath)Úimport_path)Ú
ImportMode)Úresolve_package_path)Úsafe_exists)ÚStash)ÚPytestConfigWarning)Úwarn_explicit_for)Ú_TracebackStyle)ÚTerminalReporter)ÚArgumentÚpytestc                   @   s(   e Zd ZdZdZdZdZdZdZdZ	dS )	ÚExitCodez�Encodes 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© rB   rB   úT/var/www/html/CropPilot/venv/lib/python3.10/site-packages/_pytest/config/__init__.pyr3   U   s    r3   c                       sF   e Zd Zdedeee eef ddf‡ fdd„Zde	fdd„Z
‡  ZS )	ÚConftestImportFailureÚpathÚexcinfoÚreturnNc                    s   t ƒ  ||¡ || _|| _d S ©N)ÚsuperÚ__init__rE   rF   )ÚselfrE   rF   ©Ú	__class__rB   rC   rJ   m   s   
zConftestImportFailure.__init__c                 C   s   d  | jd j| jd | j¡S )Nz{}: {} (from {})r   r   )ÚformatrF   r8   rE   ©rK   rB   rB   rC   Ú__str__v   s   ÿzConftestImportFailure.__str__)r8   r9   r:   r   r   r   Ú	Exceptionr   rJ   ÚstrrP   Ú__classcell__rB   rB   rL   rC   rD   l   s    þýü	rD   ÚentryrG   c                 C   s   t | ƒodt| jƒ tj¡vS )zÓFilter 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    rR   rE   ÚsplitÚosÚsep)rT   rB   rB   rC   Ú,filter_traceback_for_conftest_import_failure|   s   rY   Úargszos.PathLike[str]Úpluginsc              
   C   sh  zˆzt | |ƒ}W nV ty^ } zJt |j¡}ttjƒ}|jd|j	› d�dd� |j
 t¡|_
|j
r8|jddd�n| ¡ }t|ƒ}| ¡ D ]}|j| ¡ dd� qDtjW  Y d}~W S d}~ww z$|jj|d	�}	zt|	ƒW W | ¡  W S  tyƒ   |	 Y W | ¡  W S w | ¡  w  ty³ } zttjƒ}|jD ]}
|jd
|
› d�dd� q˜tjW  Y d}~S d}~w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.
    z$ImportError while loading conftest 'z'.T)ÚredÚshortF)ÚstyleÚchainN©ÚconfigzERROR: Ú
)Ú_prepareconfigrD   r   Úfrom_exc_inforF   r!   ÚsysÚstderrÚlinerE   Ú	tracebackÚfilterrY   ÚgetreprÚexconlyrR   Ú
splitlinesÚrstripr3   r@   ÚhookÚpytest_cmdline_mainÚ_ensure_unconfigureÚ
ValueErrorr   rZ   )rZ   r[   ra   ÚeÚexc_infoÚtwÚexc_reprÚformatted_tbrg   ÚretÚmsgrB   rB   rC   Úmain‡   sN   
ÿÿý€ñÿ
ýý


€üry   c                  C   sN   zt ƒ } tj ¡  | W S  ty&   t tjtj¡}t 	|tj 
¡ ¡ Y dS w )zoThe CLI entry point of pytest.

    This function is not meant for programmable use; use `main()` instead.
    r   )ry   re   ÚstdoutÚflushÚBrokenPipeErrorrW   ÚopenÚdevnullÚO_WRONLYÚdup2Úfileno)Úcoder~   rB   rB   rC   Úconsole_main¹   s   
ûrƒ   c                   @   s   e Zd ZeeƒZdS )ÚcmdlineN)r8   r9   r:   Ústaticmethodry   rB   rB   rB   rC   r„   Ë   ó    r„   rE   Úoptnamec                 C   s"   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: ©rW   rE   Úisdirr   ©rE   r‡   rB   rB   rC   Úfilename_argÏ   ó   r‹   c                 C   s"   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Š   rB   rB   rC   Údirectory_argÚ   rŒ   r�   )Úmarkry   ÚrunnerÚfixturesÚ
helpconfigÚpythonÚterminalÚ	debuggingÚunittestÚcaptureÚskippingÚ
legacypathÚtmpdirÚmonkeypatchÚrecwarnÚpastebinÚnoseÚ	assertionÚjunitxmlÚdoctestÚcacheproviderÚfreeze_supportÚ	setuponlyÚ	setupplanÚstepwiseÚwarningsÚloggingÚreportsÚpython_path)r5   é   ÚunraisableexceptionÚthreadexceptionÚfaulthandlerÚpytesterÚpytester_assertionsÚConfigc                 C   sT   t ƒ }t|tj| p
d|t ¡ d�d�}| d ur|j| dd� tD ]}| |¡ q |S )NrB   ©rZ   r[   Údir©Úinvocation_paramsT©Úexclude_only)ÚPytestPluginManagerr°   ÚInvocationParamsr   ÚcwdÚconsider_preparseÚdefault_pluginsÚimport_plugin)rZ   r[   Úpluginmanagerra   ÚspecrB   rB   rC   Ú
get_config  s   ýþ	r¿   r·   c                   C   s   t ƒ jS )zíObtain 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½   rB   rB   rB   rC   Úget_plugin_manager)  s   rÀ   c                 C   sÂ   | d u rt jdd … } nt| tjƒrt | ¡g} nt| tƒs*d}t| | t	| ƒ¡ƒ‚t
| |ƒ}|j}z"|rJ|D ]}t|tƒrD| |¡ q7| |¡ q7|jj|| d�}|W S  ty`   | ¡  ‚ w )Nr   zG`args` parameter expected to be a list of strings, got: {!r} (type: {}))r½   rZ   )re   ÚargvÚ
isinstancerW   ÚPathLikeÚfspathÚlistÚ	TypeErrorrN   Útyper¿   r½   rR   Úconsider_pluginargÚregisterrn   Úpytest_cmdline_parseÚBaseExceptionrp   )rZ   r[   rx   ra   r½   ÚpluginrB   rB   rC   rc   4  s0   
ÿ

ÿþrc   c                 C   s   |   ¡ r| jS | S )z<Get the directory of a path - itself if already a directory.)Úis_fileÚparent)rE   rB   rB   rC   Ú_get_directoryT  s   rÏ   ÚmethodÚ	hook_typeÚ	opt_names.c           
      C   sÎ   t r	t | ¡s	J ‚dd„ t| dg ƒD ƒ}g }i }|D ]0}t| |tƒ}|tur5| |› d|› �¡ d||< q||v rF| |› d�¡ d||< qd||< q|red |¡}tjj	j
|| j|d	�}	ttt| ƒ|	ƒ |S )
Nc                 S   s   h | ]}|j ’qS rB   ©Úname)Ú.0ÚmrB   rB   rC   Ú	<setcomp>d  s    z)_get_legacy_hook_marks.<locals>.<setcomp>Ú
pytestmarkú=Tz=TrueFú, )rÇ   ÚfullnameÚ	hook_opts)r   ÚinspectÚ	isroutineÚgetattrÚAttributeErrorÚappendÚjoinÚ_pytestÚ
deprecatedÚHOOK_LEGACY_MARKINGrN   r:   r.   r	   r   )
rÐ   rÑ   rÒ   Úknown_marksÚ	must_warnÚoptsÚopt_nameÚopt_attrrÜ   ÚmessagerB   rB   rC   Ú_get_legacy_hook_marks\  s.   



ýrì   c                       s@  e Zd ZdZdD‡ fdd„Zdedef‡ fdd	„Zdef‡ fd
d„Z	dEdede	e de	e f‡ fdd„Z
defdd„Zdedefdd„ZdFdd„Zdeeeef  dededede	e deeef ddfdd„Zdedefdd „Zd!edeeef deddfd"d#„Zdedeeef dedeej fd$d%„Zdededeeef dedeejef f
d&d'„Zd(edeeef dedejfd)d*„Zd+ejd(eddfd,d-„Zd.d/œdee d0eddfd1d2„Zd3eddfd4d5„Zd6ejddfd7d8„Z dDd9d:„Z!d+ejddfd;d<„Z"d=edejeee f ddfd>d?„Z#dGd@edAeddfdBdC„Z$‡  Z%S )Hr·   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.
    rG   Nc                    sà   dd l }tƒ  d¡ tƒ | _i | _d | _d| _tdƒt	ƒ| _	tƒ | _
g | _|  |j¡ |  | ¡ tj d¡retj}t|ddƒ}ztt | ¡ ¡|jd|d	�}W n	 tyX   Y nw | jj |j¡ |  ¡  |j  ¡ | _!d| _"d S )
Nr   r2   Fé   ÚPYTEST_DEBUGÚencodingÚutf8r   )ÚmodeÚ	bufferingrï   )#Ú_pytest.assertionrI   rJ   ÚsetÚ_conftest_pluginsÚ_dirpath2confmodsÚ_confcutdirÚ_noconftestr   rÏ   Ú_duplicatepathsÚskipped_pluginsÚadd_hookspecsÚhookspecrÉ   rW   ÚenvironÚgetre   rf   rß   r}   Údupr�   rñ   rQ   ÚtraceÚrootÚ	setwriterÚwriteÚenable_tracingrž   ÚDummyRewriteHookÚrewrite_hookÚ_configured)rK   rã   Úerrrï   rL   rB   rC   rJ   †  s8   

üÿ
zPytestPluginManager.__init__rÌ   rÔ   c                    sX   |  d¡sd S |dkrd S tƒ  ||¡}|d ur|S t||ƒ}t |¡s&d S t|ddƒS )NÚpytest_Úpytest_pluginsÚimpl)ÚtryfirstÚtrylastÚoptionalhookÚhookwrapper)Ú
startswithrI   Úparse_hookimpl_optsrß   rÝ   rÞ   rì   )rK   rÌ   rÔ   rè   rÐ   rL   rB   rC   r  »  s   


ÿz'PytestPluginManager.parse_hookimpl_optsc                    s:   t ƒ  ||¡}|d u rt||ƒ}| d¡rt|ddƒ}|S )Nr	  r¾   )ÚfirstresultÚhistoric)rI   Úparse_hookspec_optsrß   r  rì   )rK   Úmodule_or_classrÔ   rè   rÐ   rL   rB   rC   r  Ò  s   

ýz'PytestPluginManager.parse_hookspec_optsc              	      sp   |t jjv rt td | dd¡¡ƒ¡ d S tƒ  	||¡}|r6| j
jjt|| d�d� t|tjƒr6|  |¡ |S )NzQ{} plugin has been merged into the core, please remove it from your requirements.Ú_ú-)rÌ   Úmanager©Úkwargs)rã   rä   ÚDEPRECATED_EXTERNAL_PLUGINSr¦   Úwarnr-   rN   ÚreplacerI   rÉ   rn   Úpytest_plugin_registeredÚcall_historicÚdictrÂ   ÚtypesÚ
ModuleTypeÚconsider_module)rK   rÌ   rÔ   rw   rL   rB   rC   rÉ   Þ  s$   
ÿþÿ
ÿ
zPytestPluginManager.registerc                 C   s   |   |¡}|S rH   )Ú
get_plugin)rK   rÔ   rÌ   rB   rB   rC   Ú	getpluginõ  s   
zPytestPluginManager.getpluginc                 C   s   t |  |¡ƒS )z:Return whether a plugin with the given name is registered.)Úboolr$  )rK   rÔ   rB   rB   rC   Ú	haspluginú  ó   zPytestPluginManager.haspluginra   r°   c                 C   s"   |  dd¡ |  dd¡ d| _dS )ú:meta private:Úmarkerszµtryfirst: 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.z±trylast: 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  )rK   ra   rB   rB   rC   Úpytest_configureþ  s   þþ
z$PytestPluginManager.pytest_configurerZ   ÚpyargsÚ
noconftestÚrootpathÚ
confcutdirÚ
importmodec                 C   sž   t  ¡ }|rt|| ƒnd| _|| _|| _d}|D ](}	t|	ƒ}
|
 d¡}|dkr.|
d|… }
t||
 ƒ}t|ƒrA|  	|||¡ d}q|sM|  	|||¡ 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::éÿÿÿÿT)
r   r¹   r&   r÷   rø   Ú_using_pyargsrR   Úfindr+   Ú_try_load_conftest)rK   rZ   r-  r.  r/  r0  r1  ÚcurrentÚfoundanchorÚintitial_pathrE   ÚiÚanchorrB   rB   rC   Ú_set_initial_conftests  s$   
€ÿz*PytestPluginManager._set_initial_conftestsrE   c                 C   s   | j du rdS || j jvS )z`Whether a path is within the confcutdir.

        When false, should not load conftest.
        NT)r÷   Úparents)rK   rE   rB   rB   rC   Ú_is_in_confcutdir8  s   
z%PytestPluginManager._is_in_confcutdirr:  c                 C   sD   |   |||¡ | ¡ r| d¡D ]}| ¡ r|   |||¡ qd S d S )Nztest*)Ú_getconftestmodulesÚis_dirÚglob)rK   r:  r1  r/  ÚxrB   rB   rC   r5  A  s   €ýz&PytestPluginManager._try_load_conftestc           
      C   sˆ   | j rg S |  |¡}| j |¡}|d ur|S g }t|g|j¢R ƒD ]}|  |¡r<|d }| ¡ r<|  |||¡}	| 	|	¡ q!|| j|< |S )Nzconftest.py)
rø   rÏ   rö   rþ   Úreversedr<  r=  rÍ   Ú_importconftestrá   )
rK   rE   r1  r/  Ú	directoryÚexisting_clistÚclistrÎ   ÚconftestpathÚmodrB   rB   rC   r>  K  s    


€
z'PytestPluginManager._getconftestmodulesc              	   C   sL   | j |||d�}t|ƒD ]}z
|t||ƒfW   S  ty!   Y qw t|ƒ‚)N)r/  )r>  rB  rß   rà   ÚKeyError)rK   rÔ   rE   r1  r/  ÚmodulesrH  rB   rB   rC   Ú_rget_with_confmodf  s   ÿz&PytestPluginManager._rget_with_confmodrG  c              
   C   s  |   t|ƒ¡}|d urttj|ƒS t|ƒ}|d u rt|jƒ z	t|||d�}W n! t	yH } z|j
d us6J ‚t|ƒ||j
f}t||ƒ|‚d }~ww |  ||¡ | j |¡ |j}	|	| jv r{| j ¡ D ]\}
}|	|
jv so|
|	krz||vsuJ ‚| |¡ qb|  d|›�¡ |  |¡ |S )N)rñ   r  zloading conftestmodule )r$  rR   r	   r!  r"  r*   Ú_ensure_removed_sysmoduleÚstemr(   rQ   Ú__traceback__rÇ   rD   Ú_check_non_top_pytest_pluginsrõ   ÚaddrÎ   rö   Úitemsr<  rá   r   Úconsider_conftest)rK   rG  r1  r/  ÚexistingÚpkgpathrH  rr   rs   ÚdirpathrE   ÚmodsrB   rB   rC   rC  u  s4   
€ý

€
z#PytestPluginManager._importconftestrH  c                 C   s@   t |dƒr| jr| jsd}t| || j¡d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  r3  r$   rN   r÷   )rK   rH  rG  rx   rB   rB   rC   rO  ”  s   ÿþýÿ	òz1PytestPluginManager._check_non_top_pytest_pluginsFrµ   r¶   c                C   s®   d}t |ƒ}||k rU|| }|d7 }t|tƒrO|dkr1z|| }W n
 ty+   Y dS w |d7 }n| d¡r=|dd… }nq| ¡ }|rJ| d¡sJq|  |¡ ||k s
dS dS )r)  r   r   z-pNr4   úno:)ÚlenrÂ   rR   Ú
IndexErrorr  ÚstriprÈ   )rK   rZ   r¶   r9  ÚnÚoptÚpargrB   rB   rC   rº   ®  s*   
ÿ


ïz%PytestPluginManager.consider_preparseÚargc                 C   sÌ   |  d¡r8|dd… }|tv rtd| ƒ‚|dkr#|  d¡ |  d¡ |  |¡ |  d¡s6|  d| ¡ dS dS |}| j |d	¡du rG| j|= |  d¡s]| j d| d	¡du r]| jd| = | j|d
d� dS )r)  rY  r5   Nzplugin %s cannot be disabledr¡   r¥   Úpytest_stepwiser	  r2  T)Úconsider_entry_points)r  Úessential_pluginsr   Úset_blockedÚ_name2pluginrþ   r¼   )rK   r`  rÔ   rB   rB   rC   rÈ   Ç  s$   




ÿ
z&PytestPluginManager.consider_pluginargÚconftestmodulec                 C   s   | j ||jd� dS )r)  rÓ   N)rÉ   Ú__file__)rK   rf  rB   rB   rC   rR  á  s   z%PytestPluginManager.consider_conftestc                 C   s   |   tj d¡¡ dS )r)  ÚPYTEST_PLUGINSN)Ú_import_plugin_specsrW   rý   rþ   rO   rB   rB   rC   Úconsider_envå  ó   z PytestPluginManager.consider_envc                 C   s   |   t|dg ƒ¡ dS )r)  r
  N)ri  rß   )rK   rH  rB   rB   rC   r#  é  rk  z#PytestPluginManager.consider_moduler¾   c                 C   s    t |ƒ}|D ]}|  |¡ qd S rH   )Ú_get_plugin_specs_as_listr¼   )rK   r¾   r[   Úimport_specrB   rB   rC   ri  í  s   ÿz(PytestPluginManager._import_plugin_specsÚmodnamerb  c              
   C   s
  t |tƒsJ d| ƒ‚|  |¡s|  |¡durdS |tv r!d| n|}| j |¡ |r6| jd|d�}|r6dS zt|ƒ W n; t	yZ } zt	d|› d|j
d › �ƒ |j¡|‚d}~w tyw } z| j ||jpid	f¡ W Y d}~dS d}~ww tj| }|  ||¡ dS )
z™Import 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Â   rR   Ú
is_blockedr$  Úbuiltin_pluginsr  Úmark_rewriteÚload_setuptools_entrypointsÚ
__import__ÚImportErrorrZ   Úwith_tracebackrN  r%   rú   rá   rx   re   rJ  rÉ   )rK   rn  rb  Ú
importspecÚloadedrr   rH  rB   rB   rC   r¼   ô  s4   
ÿÿ
þ€$€ÿ
z!PytestPluginManager.import_plugin©rG   NrH   )ra   r°   rG   N)F)&r8   r9   r:   r;   rJ   Ú_PluggyPluginrR   r  r  r   rÉ   r%  r&  r'  r,  r   r   r   r)   r;  r=  r5  r!  r"  r>  r   r   rK  rC  rO  rº   rÈ   rR  rj  r#  ri  r¼   rS   rB   rB   rL   rC   r·   |  s¾    5ÿÿÿþ
þýüûú
ù
ø%	ÿ
ÿÿ
þ
ÿ
ÿÿ
þþý
üû
úÿ
ÿÿ
þþý
üÿÿÿ
þ
ÿ
þ Úspecsc                 C   sZ   | du rg S t | tjƒrg S t | tƒr| r|  d¡S g S t | tjjƒr't| ƒS t	d|  ƒ‚)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"  rR   rV   ÚcollectionsÚabcr   rÅ   r   )r|  rB   rB   rC   rl    s   
ÿÿrl  rn  c                 C   s$   zt j| = W d S  ty   Y d S w rH   )re   rJ  rI  )rn  rB   rB   rC   rL  0  s
   ÿrL  c                   @   s   e Zd Zdd„ ZdS )ÚNotsetc                 C   s   dS )Nz<NOTSET>rB   rO   rB   rB   rC   Ú__repr__8  s   zNotset.__repr__N)r8   r9   r:   r�  rB   rB   rB   rC   r€  7  r†   r€  Úpackage_filesc                 c   sè   � t | ƒ} d}| D ]=}d|vo| d¡}| d¡dko| d¡}|r9tj |¡\}}|dkr8| d¡s8d}|V  q	|rFtj |¡}d}|V  q	|spg }| D ]}| d¡}	d 	|	dd	… ¡}
|
rd| 
|
¡ qM|rrt|ƒE d	H  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ÚcountrW   rE   Úsplitextr  ÚdirnamerV   râ   rá   Ú_iter_rewritable_modules)r‚  Ú	seen_someÚfnÚis_simple_moduleÚ
is_packageÚmodule_namer  Úpackage_nameÚnew_package_filesÚpartsÚnew_fnrB   rB   rC   rŠ  ?  s:   € €€

€órŠ  c                   @   s^  e Zd ZdZeejdd�G dd„ dƒƒƒZG dd„ dej	ƒZ
dd	œd
edee ddfdd„Zedefdd„ƒZedee fdd„ƒZdeg df ddfdd„Zdvdd„Zdvdd„Zdefdd„Zd
edee dd fdd„Z	dwdee d eej ddfd!d"„Zd#edefd$d%„Z e!dxd&d'„ƒZ"dyd*d+„Z#e$dd,�dzd.d/„ƒZ%de&e ddfd0d1„Z'de&e ddfd2d3„Z(dvd4d5„Z)dee d6edee fd7d8„Z*dee d9ee d:ee d;ed<ed=e+de,ee e
f fd>d?„Z-d{dee d@e+ddfdAdB„Z.e$ddC�de/dD fdEdF„ƒZ0dvdGdH„Z1dvdIdJ„Z2dvdKdL„Z3dMeddfdNdO„Z4dee fdPdQ„Z5d{dee d@e+ddfdRdS„Z6dTe7dUe8ddfdVdW„Z9dXedYeddfdZd[„Z:dXefd\d]„Z;dXed^ed_e<eee f fd`da„Z=dXefdbdc„Z>dXedded<edeee  fdedf„Z?dXedee fdgdh„Z@eAdifdXedje+fdkdl„ZBdwdXefdmdn„ZCdwdXefdodp„ZDdqeddfdrds„ZEdvdtdu„ZFd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                   @   sv   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d	„ZdS )
z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.
        .rZ   r[   r²   rG   Nc                C   s2   t  | dt|ƒ¡ t  | d|¡ t  | d|¡ d S )NrZ   r[   r²   )ÚobjectÚ__setattr__Útuple)rK   rZ   r[   r²   rB   rB   rC   rJ   ¤  s   z Config.InvocationParams.__init__)r8   r9   r:   r;   r   rR   Ú__annotations__r   r   r   r{  r   r   rJ   rB   rB   rB   rC   r¸   Œ  s"   
 ýüûúr¸   c                   @   s(   e Zd ZdZe ¡ Ze ¡ Ze ¡ ZdS )zConfig.ArgsSourcezSIndicates the source of the test arguments.

        .. versionadded:: 7.2
        N)	r8   r9   r:   r;   ÚenumÚautoÚARGSÚINCOVATION_DIRÚ	TESTPATHSrB   rB   rB   rC   Ú
ArgsSource¯  s
    rž  Nr³   r½   r´   rG   c                C   s   ddl m}m} |d u r| jdd t ¡ d�}t ¡ | _	 || _		 |}|d|› d|› d�| j
dd	�| _|| _	 tƒ | _	 | j| _dd
lm} | jjj d¡| _|| jjƒ| _i | _d| _i | _g | _| j | d¡ d| _| jjjt| j| jd�d� tj j!| _"g | _#t$rŽddl%m&} d | _'d S d S )Nr   )ÚParserÚFILE_OR_DIRrB   r±   z%(prog)s [options] [z] [z] [...]T)ÚusageÚ
processoptÚ	_ispytest)ÚPathAwareHookProxyra   ÚpytestconfigF)Úparserr½   r  r   )ÚCache)(Ú
argparsingrŸ  r   r¸   r   r¹   ÚargparseÚ	NamespaceÚoptionr´   Ú_processoptÚ_parserr½   r,   ÚstashÚ_storeÚcompatr¤  r   r  rþ   rn   Ú	_inicacheÚ_override_iniÚ	_opt2destÚ_cleanuprÉ   r  Úpytest_addoptionr  r   r°   rž  r›  Úargs_sourcerZ   r   Ú_pytest.cacheproviderr§  Úcache)rK   r½   r´   rŸ  r   Ú_ar¤  r§  rB   rB   rC   rJ   ¼  sL   
ÿ
ýÿ

ýzConfig.__init__c                 C   ó   | j S )znThe path to the :ref:`rootdir <rootdir>`.

        :type: pathlib.Path

        .. versionadded:: 6.1
        )Ú	_rootpathrO   rB   rB   rC   r/  ÿ  ó   zConfig.rootpathc                 C   rº  )zThe path to the :ref:`configfile <configfiles>`.

        :type: Optional[pathlib.Path]

        .. versionadded:: 6.1
        )Ú_inipathrO   rB   rB   rC   Úinipath	  r¼  zConfig.inipathÚfuncc                 C   s   | 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á   )rK   r¿  rB   rB   rC   Úadd_cleanup  s   zConfig.add_cleanupc                 C   s^   | j rJ ‚d| _ t ¡ � t d¡ | jjjt| d�d� W d   ƒ d S 1 s(w   Y  d S )NTÚdefaultr`   r  )r  r¦   Úcatch_warningsÚsimplefilterrn   r,  r  r   rO   rB   rB   rC   Ú_do_configure  s   


"þzConfig._do_configurec                 C   sH   | j rd| _ | jj| d� g | jj_| jr"| j ¡ }|ƒ  | jsd S d S )NFr`   )r  rn   Úpytest_unconfigurer,  Ú_call_historyr´  Úpop)rK   ÚfinrB   rB   rC   rp     s   

þzConfig._ensure_unconfigurec                 C   s   | j  d¡}|d usJ ‚|jS )NÚterminalreporter)r½   r$  Ú_tw)rK   rÉ  rB   rB   rC   Úget_terminal_writer(  s
   ÿzConfig.get_terminal_writerrZ   c                 C   s†   z|   |¡ W | S  tyB   t| jddƒsd|v r%ddlm} || ƒ ‚ t| jddƒs4d|v s4d|v rA| j ¡  ¡  t	j
 d	¡ ‚ w )
NÚversionFz	--versionr   )ÚshowversionÚhelpz--helpz-hz8
NOTE: displaying only minimal help due to UsageError.

)Úparser   rß   r«  Ú_pytest.helpconfigrÍ  r­  Ú
_getparserÚ
print_helpre   rz   r  )rK   r½   rZ   rÍ  rB   rB   rC   rÊ   /  s"   î	ùÿÿðzConfig.pytest_cmdline_parserF   r«  c                 C   s€   |rt |ddƒrd}nd}|jdt |ddƒ|d�}| jj||d�}t|ƒs<t|ƒ d	¡D ]}tj 	d
| ¡ tj 
¡  q,d S d S )NÚ	fulltraceFÚlongÚnativeTÚ
showlocals)ÚfuncargsrÖ  r^   )ÚexcreprrF   rb   zINTERNALERROR> %s
)rß   rj   rn   Úpytest_internalerrorÚanyrR   rV   re   rf   r  r{   )rK   rF   r«  r^   rØ  Úresrg   rB   rB   rC   Únotify_exceptionH  s   ÿýzConfig.notify_exceptionÚnodeidc                 C   s*   | j j| jkr| j| }t| j j|ƒ}|S rH   )r´   r²   r/  r'   )rK   rÝ  ÚfullpathrB   rB   rC   Úcwd_relative_nodeidZ  s   
zConfig.cwd_relative_nodeidc                 C   sB   t |ƒ}|jj |¡ |j|dd� |jjD ]}|j |¡ q|S )z$Constructor usable for subprocesses.F©Úaddopts)r¿   r«  Ú__dict__ÚupdaterÏ  r[   r½   rÈ   )ÚclsÚoption_dictrZ   ra   rA  rB   rB   rC   Úfromdictargsa  s   zConfig.fromdictargsr^  r1   c                 C   sT   |j |j D ]}|j| j|< qt|dƒr&t| j|jƒs(t| j|j|jƒ d S d S d S )NrÁ  )Ú_short_optsÚ
_long_optsÚdestr³  rX  r«  ÚsetattrrÁ  )rK   r^  rÔ   rB   rB   rC   r¬  k  s   
þzConfig._processopt)r  Úearly_configc                 C   s\   |j |jj|jj| d¡|jj|jdd�\}}| jj	||jj|jj
|j|jj|jjd� d S )NÚ	testpathsF©rZ   r-  rì  Úinvocation_dirr/  r  )rZ   r-  r.  r/  r0  r1  )Ú_decide_argsÚknown_args_namespaceÚfile_or_dirr-  Úgetinir´   r²   r/  r½   r;  r.  r0  r1  )rK   rë  rZ   r¶  rB   rB   rC   Úpytest_load_initial_conftestss  s    
ú
úz$Config.pytest_load_initial_conftestsc                 C   s¸   | j j|t | j¡d�\}}t|j|j| |jpd | d�\}}}|| _|| _	|| _
t| jƒ| j jd< t| jƒ| j jd< | j  ddd¡ | j  dd	¡ | j jd
ddg d� |jpXd| _d S )N©Ú	namespace)Úrootdir_cmd_argra   ÚrootdirÚinifilerá  zExtra command line optionsrZ   Ú
minversionz!Minimally required pytest versionÚrequired_pluginsz.Plugins that must be present for pytest to run)rÇ   rÁ  rB   )r­  Úparse_known_and_unknown_argsÚcopyr«  r   Úinifilenamerñ  r÷  r»  r½  ÚinicfgrR   r/  Ú
extra_infor¾  ÚaddiniÚoverride_inir²  )rK   rZ   ÚnsÚunknown_argsr/  r¾  rþ  rB   rB   rC   Ú_initiniŠ  s.   
ÿüüzConfig._initinic                 C   sl   | j  |¡\}}t|ddƒ}|dkr/ddl}z|j | ¡}W n ty)   d}Y nw |  |¡ |  |¡ dS )zïInstall 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ÚSystemErrorÚ_mark_plugins_for_rewriteÚ_warn_about_missing_assertion)rK   rZ   r  r  rñ   rã   rn   rB   rB   rC   Ú_consider_importhook£  s   ÿ
zConfig._consider_importhookc                 C   sF   || j _tj d¡rdS dd„ t ¡ D ƒ}t|ƒD ]}| |¡ qdS )z‹Given an importhook, mark for rewrite any top-level
        modules or packages in the distribution package for
        all pytest plugins.ÚPYTEST_DISABLE_PLUGIN_AUTOLOADNc                 s   s<   � | ]}t d d„ |jD ƒƒr|jpg D ]}t|ƒV  qqdS )c                 s   s   � | ]}|j d kV  qdS )ro  N)Úgroup)rÕ   ÚeprB   rB   rC   Ú	<genexpr>Ä  s   € z=Config._mark_plugins_for_rewrite.<locals>.<genexpr>.<genexpr>N)rÚ  Úentry_pointsÚfilesrR   )rÕ   ÚdistÚfilerB   rB   rC   r  Á  s   € ýüýÿz3Config._mark_plugins_for_rewrite.<locals>.<genexpr>)	r½   r  rW   rý   rþ   r#   ÚdistributionsrŠ  rs  )rK   rn   r‚  rÔ   rB   rB   rC   r
  ·  s   þÿz Config._mark_plugins_for_rewriteÚviac                 C   s6   || j _z| j j|t | j¡d� W | j `|S | j `w )zValidate known args.rô  )r­  Ú_config_source_hintrû  rü  r«  )rK   rZ   r  rB   rB   rC   Ú_validate_argsË  s   ÿþzConfig._validate_argsr-  rì  rî  r/  r  c                C   sž   |rt jj}|}||fS ||kr>t jj}|r|}n'g }|D ]}	| ttj|	dd�ƒ¡ q|r=|s=|r=d}
| jt	|
ƒdd� ng }|sKt jj
}t|ƒg}||fS )z„Decide the args (initial paths/nodeids) to use given the relevant inputs.

        :param warn: Whether can issue warnings.
        T)Ú	recursivez˜No files were found in testpaths; consider removing or adjusting your testpaths configuration. Searching recursively from the current directory instead.r5   ©Ú
stacklevel)r°   rž  r›  r�  ÚextendÚsortedr@  ÚiglobÚissue_config_time_warningr-   rœ  rR   )rK   rZ   r-  rì  rî  r/  r  ÚsourceÚresultrE   Úwarning_textrB   rB   rC   rï  ×  s0   éÿÿ€
zConfig._decide_argsrá  c              
   C   s¬  |rt j dd¡}t|ƒr|  t |¡d¡| |d d …< |  |¡ |r2|  |  d¡d¡| |d d …< | j	j
|t | j¡d�| _|  ¡  |  |¡ | jj|dd� t j d	¡s\| j d
¡ | j ¡  | j	j
|t | j¡d�| _|  ¡  |  ¡  | jjrƒ| jtjjdd� | jjd u rž| jd ur•t| jjƒ}nt| jƒ}|| j_z| j j!| || j	d� W d S  t"yÕ } z| jj#s»| jj$rÉ| jt%d|j&› �ƒdd� n‚ W Y d }~d S d }~ww )NÚPYTEST_ADDOPTSrp  zvia PYTEST_ADDOPTSrá  zvia addopts configrô  Frµ   r  ro  r4   r  )rë  rZ   r¦  z"could not load initial conftests: )'rW   rý   rþ   rZ  r  ÚshlexrV   r  rò  r­  Úparse_known_argsrü  r«  rð  Ú_checkversionr  r½   rº   rt  rj  Ú_validate_pluginsÚ_warn_about_skipped_pluginsÚstrictr  rã   rä   ÚSTRICT_OPTIONr0  r¾  rR   rÎ   r/  rn   ró  rD   rÎ  rÌ  r-   rE   )rK   rZ   rá  Úenv_addoptsr0  rr   rB   rB   rC   Ú	_preparse  s`   ÿ
ÿ

ÿÿ

ÿÿ

ÿþû€üzConfig._preparse)r  )NNNc                 c   s   � d V  |   ¡  d S rH   )Ú_validate_config_optionsrO   rB   rB   rC   Úpytest_collection=  s   €zConfig.pytest_collectionc                 C   sr   dd l }| j dd ¡}|r5ddlm} t|tƒs | d| j ¡‚||ƒ||j	ƒkr7| d| j||j	f ¡‚d S d S )Nr   rù  ©ÚVersionz'%s: 'minversion' must be a single valuez6%s: 'minversion' requires pytest-%s, actual pytest-%s')
r2   rþ  rþ   Úpackaging.versionr0  rÂ   rR   r   r¾  Ú__version__)rK   r2   Úminverr0  rB   rB   rC   r&  D  s&   
ÿýÿÿö	zConfig._checkversionc                 C   s(   t |  ¡ ƒD ]}|  d|› d�¡ qd S )NzUnknown config option: rb   )r  Ú_get_unknown_ini_keysÚ_warn_or_fail_if_strict)rK   ÚkeyrB   rB   rC   r-  [  s   ÿzConfig._validate_config_optionsc           
   	   C   sØ   t |  d¡ƒ}|sd S ddlm} ddlm}m} | j ¡ }dd„ |D ƒ}g }|D ]4}z||ƒ}	W n |y?   | 	|¡ Y q)w |	j
|vrK| 	|¡ q)|	jj|||	j
 ƒdd�s]| 	|¡ q)|rjtd	 d
 |¡¡ƒ‚d S )Nrú  r   r/  )ÚInvalidRequirementÚRequirementc                 S   s   i | ]	\}}|j |j“qS rB   )Úproject_namerÌ  )rÕ   r  r  rB   rB   rC   Ú
<dictcomp>i  s    z,Config._validate_plugins.<locals>.<dictcomp>T)ÚprereleaseszMissing required plugins: {}rÚ   )r  rò  r1  r0  Úpackaging.requirementsr7  r8  r½   Úlist_plugin_distinforá   rÔ   Ú	specifierÚcontainsr   rN   râ   )
rK   rú  r0  r7  r8  Úplugin_infoÚplugin_dist_infoÚmissing_pluginsÚrequired_pluginÚreqrB   rB   rC   r'  _  s6   

þ
ÿ
€ÿÿzConfig._validate_pluginsrë   c                 C   s&   | j jrt|ƒ‚| jt|ƒdd� d S )Nr5   r  )rð  Ústrict_configr   r  r-   )rK   rë   rB   rB   rC   r5    s   zConfig._warn_or_fail_if_strictc                    s   | j j‰ ‡ fdd„| jD ƒS )Nc                    s   g | ]}|ˆ vr|‘qS rB   rB   )rÕ   rÔ   ©Úparser_inicfgrB   rC   Ú
<listcomp>‡  s    z0Config._get_unknown_ini_keys.<locals>.<listcomp>)r­  Ú_inidictrþ  rO   rB   rF  rC   r4  …  s   zConfig._get_unknown_ini_keysc                 C   s°   | j g ks	J dƒ‚| jjjt| jd�d� | j||d� | jj| |d� d| j_	z%| jj
|| j| jd�}| j|| jj|  d¡| jj| jdd	�\| _ | _W d S  tyW   Y d S w )
Nz:can only parse cmdline args at most once per Config object)r½   r  rà  )ra   rZ   Trô  rì  rí  )rZ   rn   Úpytest_addhooksr  r   r½   r,  Úpytest_cmdline_preparser­  Úafter_preparseÚparse_setoptionr«  rï  rð  r-  rò  r´   r²   r/  r¶  r   )rK   rZ   rá  rB   rB   rC   rÏ  ‰  s0   ÿ
ÿ
ÿúÿzConfig.parseÚwarningr  c                 C   sÈ   | j  d¡rdS | jjpg }|  d¡}tjdd��}t dt|ƒ¡ t	||ƒ tj
||d� W d  ƒ n1 s8w   Y  |rbt |d ¡}|jj|j|jjf}| jjjt|d	 d
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 hookwrappers 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   ra   rp  )Úwarning_messageÚwhenrÝ  Úlocationr  )r½   rq  rð  Úpythonwarningsrò  r¦   rÂ  rÃ  rÇ   Úapply_warning_filtersr  re   Ú	_getframeÚf_codeÚco_filenameÚf_linenoÚco_namern   Úpytest_warning_recordedr  r   )rK   rN  r  Úcmdline_filtersÚconfig_filtersÚrecordsÚframerT  rB   rB   rC   r  ¤  s*   

ýü
ÿýz Config.issue_config_time_warningrÔ   rg   c                 C   s&   |   |¡}t|tƒsJ ‚| |¡ dS )z©Add 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)rò  rÂ   rÅ   rá   )rK   rÔ   rg   rA  rB   rB   rC   r+  Ç  s   
zConfig.addinivalue_linec                 C   s8   z| j | W S  ty   |  |¡ | j |< }| Y S w )a  Return configuration value from an :ref:`ini file <configfiles>`.

        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±  rI  Ú_getini)rK   rÔ   ÚvalrB   rB   rC   rò  Ï  s   þzConfig.getinirÇ   Úvaluec                 C   s   d|› �}t ||ƒ‚)Nzunknown configuration type: )rq   )rK   rÔ   rÇ   rc  rx   rB   rB   rC   Ú_getini_unknown_typeÞ  s   

zConfig._getini_unknown_typec           	   
      st  z| j j| \}}}W n ty } ztd|›�ƒ|‚d }~ww |  |¡}|d u rKz| j| }W n tyJ   |d ur?| Y S |d u rFY dS g  Y S w |}|dkrq| jd usXJ ‚| jj‰ t|t	ƒrft
 |¡n|}‡ fdd„|D ƒS |dkr�t|t	ƒrt
 |¡S |S |dkr›t|t	ƒr™dd„ td	d
„ | d¡ƒD ƒS |S |dkr§tt	|ƒ ¡ ƒS |dkr­|S |d u r³|S |  |||¡S )Nzunknown configuration value: rp  Úpathsc                    s   g | ]}ˆ | ‘qS rB   rB   )rÕ   rA  ©ÚdprB   rC   rH    ó    z"Config._getini.<locals>.<listcomp>rZ   Úlinelistc                 S   s   g | ]}|r|‘qS rB   rB   )rÕ   ÚtrB   rB   rC   rH    rh  c                 S   s   |   ¡ S rH   ©r\  )rA  rB   rB   rC   Ú<lambda>  s    z Config._getini.<locals>.<lambda>rb   r&  Ústring)r­  rI  rI  rq   Ú_get_override_ini_valuerþ  r¾  rÎ   rÂ   rR   r$  rV   ÚmapÚ
_strtoboolr\  rd  )	rK   rÔ   ÚdescriptionrÇ   rÁ  rr   Úoverride_valuerc  Úinput_valuesrB   rf  rC   ra  â  sH   €ÿ
û
zConfig._getinirE   c           	      C   sœ   z| j  |||  d¡|¡\}}W n
 ty   Y d S w |jd us"J ‚t|jƒj}g }|D ]}t|tj	ƒr9t|ƒ}n| 
dtj¡}t|| ƒ}| |¡ q,|S )Nr1  rƒ  )r½   rK  Ú	getoptionrI  rg  r   rÎ   rÂ   rW   rÃ   r  rX   r&   rá   )	rK   rÔ   rE   r/  rH  ÚrelrootsÚmodpathÚvaluesÚrelrootrB   rB   rC   Ú_getconftest_pathlist  s"   ÿÿ
zConfig._getconftest_pathlistc                 C   s^   d }| j D ]'}z
| dd¡\}}W n ty% } ztd |¡ƒ|‚d }~ww ||kr,|}q|S )NrÙ   r   z9-o/--override-ini expects option=value style (got: {!r}).)r²  rV   rq   r   rN   )rK   rÔ   rc  Ú
ini_configr6  Úuser_ini_valuerr   rB   rB   rC   rn  -  s$   
ÿÿü€ÿ€zConfig._get_override_ini_valueFÚskipc              
   C   s”   | j  ||¡}zt| j|ƒ}|du r|rt|ƒ‚|W S  tyI } z#|tur.|W  Y d}~S |r=ddl}| d|›d�¡ td|›�ƒ|‚d}~w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³  rþ   rß   r«  rà   Únotsetr2   r|  rq   )rK   rÔ   rÁ  r|  rb  rr   r2   rB   rB   rC   rt  @  s   	€ùzConfig.getoptionc                 C   s
   |   |¡S )z$Deprecated, use getoption() instead.©rt  ©rK   rÔ   rE   rB   rB   rC   ÚgetvalueX  s   
zConfig.getvaluec                 C   s   | j |dd�S )z-Deprecated, use getoption(skip=True) instead.T)r|  r~  r  rB   rB   rC   Úgetvalueorskip\  r(  zConfig.getvalueorskiprñ   c                 C   s2   t ƒ s|dkr
d}nd}| jt|ƒdd� d S d S )Nr  zRASSERTIONS ARE NOT EXECUTED and FAILING TESTS WILL PASS.  Are you using python -O?z¥assertions 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?)
r5   r  )Ú_assertion_supportedr  r-   )rK   rñ   r"  rB   rB   rC   r  `  s   ÿÿ
þñz$Config._warn_about_missing_assertionc                 C   s4   | j jD ]\}}| jtd|›d|› �ƒdd� qd S )Nzskipped plugin ú: r4   r  )r½   rú   r  r-   )rK   r�  rx   rB   rB   rC   r(  u  s   þÿz"Config._warn_about_skipped_pluginsrz  rH   )rG   r°   )r^  r1   rG   N)rë  r°   rG   N)T)Gr8   r9   r:   r;   r"   ÚdataclassesÚ	dataclassr¸   r™  ÚEnumrž  r·   r   rJ   Úpropertyr   r/  r¾  r   rÀ  rÄ  rp   r!   rË  r   rR   rÊ   r   rË   r©  rª  rÜ  rß  Úclassmethodræ  r¬  Úhookimplró  r   r  r  r
  r  r&  r   rï  r,  r   r.  r&  r-  r'  r5  r4  rÏ  ÚWarningÚintr  r+  rò  r   rd  ra  ry  rn  r}  rt  r€  r�  r  r(  rB   rB   rB   rC   r°   €  s¶    

!üþü
ûC		

	ÿÿ
þýþý
ü
	
ýüûúùø	
÷+;


 #"6ÿÿÿ

þc                   C   s   zJ ‚ t y   Y dS w )NFT)ÚAssertionErrorrB   rB   rB   rC   r‚  }  s
   ÿr‚  ra   r  c                 C   s\   t |d�}| jjdkrd|_n	| jjdkrd|_| jjdkr#d|_|S | jjdkr,d|_|S )zÚCreate 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)ra   r  rt   rB   rB   rC   Úcreate_terminal_writer†  s   
	ýr’  rb  c                 C   s.   |   ¡ } | 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�  rj  ÚtrueÚonÚ1T)r]  rŽ  ÚfÚfalseÚoffÚ0Fzinvalid truth value )Úlowerrq   )rb  rB   rB   rC   rp  ž  s   	rp  é2   )Úmaxsizer`  Úescapezwarnings._ActionKindc             
   C   s   d}t d| › d�ƒ}|  d¡}t|ƒdkr,d}t dt|ƒ› d|› d	�ƒ}t|j|d
�ƒ‚t|ƒdk r=| d¡ t|ƒdk s2dd„ |D ƒ\}}}	}
}zt |¡}W n tjyg } z
t|jt	|ƒd
�ƒ‚d}~ww zt
|	ƒ}W n ty‡   t ¡ }|jdd�}t|j|d
�ƒ‚w |r‘|r‘t |¡}|
rœ|rœt |
¡d }
|rÇzt|ƒ}|dk r«tdƒ‚W n tyÆ } zt|jd|›d|› �d
�ƒ‚d}~ww d}||||
|fS )zíParse 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}
        ú:r7   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
            )Úerrorrp  c                 s   s   � | ]}|  ¡ V  qd S rH   rk  )rÕ   ÚsrB   rB   rC   r  Û  s   € z'parse_warning_filter.<locals>.<genexpr>NrÕ  )r^   z\Zr   znumber is negativezinvalid lineno rƒ  )r   rV   rZ  r   rN   rá   r¦   Ú
_getactionÚ_OptionErrorrR   Ú_resolve_warning_categoryrQ   r   Úfrom_currentrj   Úrerž  r‹  rq   )r`  rž  Ú__tracebackhide__Úerror_templater’  Údoc_urlr   Úaction_rë   Ú	category_ÚmoduleÚlineno_Úactionrr   Úcategoryrs   Úexception_textÚlinenorB   rB   rC   Úparse_warning_filter°  sj   ýÿ
ÿÿûÿ	
ÿ€ÿý
ÿÿ€ÿr²  r¯  c                 C   sr   d}| st S d| vrddl}| }n|  d¡\}}}t|dd|gƒ}t||ƒ}t|t ƒs2t|› 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Ú
rpartitionru  rß   Ú
issubclassr   r	   r   )r¯  r§  rÖ   Úklassr¬  r  ÚcatrB   rB   rC   r¤  ø  s   

r¤  r^  r]  c                 C   s<   | D ]}t jt|dd�Ž  q|D ]}t jt|dd�Ž  qdS )z8Applies pytest-configured filters to the warnings moduleF)rž  TN)r¦   rO  r²  )r^  r]  r`  rB   rB   rC   rV    s
   ÿrV  )NN)rG   r·   rH   )r;   r©  Úcollections.abcr~  rü  r„  r™  r@  rÝ   rW   r¦  r$  re   r!  r¦   Ú	functoolsr   Úpathlibr   Útextwrapr   r   r   Útypingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   Úpluggyr   r   r   Ú_pytest._coderã   Ú_pytest.deprecatedÚ_pytest.hookspecÚ
exceptionsr   r   Ú	findpathsr   r   r    Ú_pytest._ior!   Ú_pytest.compatr"   r#   Ú_pytest.outcomesr$   r%   Ú_pytest.pathlibr&   r'   r(   r)   r*   r+   Ú_pytest.stashr,   Ú_pytest.warning_typesr-   r.   Ú_pytest._code.coder/   Ú_pytest.terminalr0   r¨  r1   r•  r{  r‰  rü   ÚIntEnumr3   rQ   rD   Ú_codeÚTracebackEntryr&  rY   rR   r‹  ry   rƒ   r„   r‹   r�   rc  Úversion_infor»   rô   rr  rP  r¿   rÀ   rc   rÏ   rì   r·   r"  rl  rL  r€  r}  rŠ  r°   r‚  r’  rp  rŠ  r²  r¤  rV  rB   rB   rB   rC   Ú<module>   s’   	ÿ
þþÿþ

ý2èçæ

þ
ÿþ
ý
þÿþ
ý ÿþ
ý

ü     ÿ
þA      
ÿÿÿ
þÿÿþGÿÿþ