o
    #if#"                     @   sR  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
mZ dd
l
mZ ddlmZ ddlmZ ddlZG dd deZdeddfddZejdddedeef fddZdeddfddZdedee	eef  fddZdeddfddZdgZdedee fdd Zdedee fd!d"ZdS )#z3Version info, help messages, tracing configuration.    )ActionN)	Generator)List)Optional)Union)Config)ExitCode)	PrintHelp)Parser)TerminalReporterc                       s,   e Zd ZdZd fdd	Zd	ddZ  ZS )

HelpActiona}  An argparse Action that will raise an exception in order to skip the
    rest of the argument parsing when --help is passed.

    This prevents argparse from quitting due to missing required arguments
    when any are defined, for example by ``pytest_addoption``.
    This is similar to the way that the builtin argparse --help option is
    implemented by raising SystemExit.
    NFc                    s   t  j||d|d|d d S )NTr   )option_stringsdestconstdefaultnargshelp)super__init__)selfr   r   r   r   	__class__ K/var/www/html/corbot_env/lib/python3.10/site-packages/_pytest/helpconfig.pyr      s   
zHelpAction.__init__c                 C   s&   t || j| j t|jddrtd S )Nafter_preparseF)setattrr   r   getattr_parserr	   )r   parser	namespacevaluesoption_stringr   r   r   __call__(   s   zHelpAction.__call__)NFN)N)__name__
__module____qualname____doc__r   r"   __classcell__r   r   r   r   r      s    	
r   r   returnc              	   C   s   |  d}|jddddddd |jd	d
tddd |jdddg ddd |jdddddd |jddddddd d! |jd"d#d$dd%d& d S )'Ndebugconfigz	--versionz-Vcountr   versionzoDisplay pytest version and information about plugins. When given twice, also display information about plugins.)actionr   r   r   z-hz--helpr   z(Show help message and configuration info)r,   r   r   z-pappendpluginsnamezEarly-load given plugin module name or entry point (multi-allowed). To avoid loading of plugins, use the `no:` prefix, e.g. `no:doctest`.)r,   r   r   metavarr   z--traceconfigz--trace-config
store_trueFz)Trace considerations of conftest.py files)r,   r   r   z--debugstore?zpytestdebug.logdebugDEBUG_FILE_NAMEzStore internal tracing debug information in this log file. This file is opened with 'w' and truncated as a result, care advised. Default: pytestdebug.log.)r,   r   r   r   r0   r   z-oz--override-inioverride_iniz^Override ini option with "option=value" style, e.g. `-o xfail_strict=True -o cache_dir=cache`.)r   r,   r   )getgroup	addoption
_addoptionr   )r   groupr   r   r   pytest_addoption0   s^   
	

r;   T)wrapperc               
   #   s    d V   j jrP j j} t| ddddtjdtt	t
j jjt  jj  jjj  j t
jd|   d
 fdd	} |  S )Nwzutf-8)encodingz@versions pytest-{}, python-{}
invocation_dir={}
cwd={}
args={}

.z'writing pytest debug information to %s
r(   c                      s2      tjdj   jjd    d S )Nz%wrote pytest debug information to %s
)closesysstderrwriter/   traceroot	setwriterr   config	debugfileundo_tracingr   r   unset_tracing~   s   
z+pytest_cmdline_parse.<locals>.unset_tracing)r(   N)optionr4   openrC   formatpytest__version__joinmapstrrA   version_infoinvocation_paramsdirosgetcwdargsrD   rE   rF   pluginmanagerenable_tracingrB   add_cleanup)pathrK   r   rG   r   pytest_cmdline_parseh   s*   


r^   rH   c                 C   sr   | j jdkr,tjdtj dtj d t| }|r(|D ]}tj|d  qd S d S tjdtj d d S )N   zThis is pytest version z, imported from 
zpytest )	rL   r+   rA   stdoutrC   rO   rP   __file__getpluginversioninfo)rH   
plugininfoliner   r   r   showversion   s   rf   c                 C   s@   | j jdkrt|  dS | j jr|   t|  |   dS d S )Nr   )rL   r+   rf   r   _do_configureshowhelp_ensure_unconfigure)rH   r   r   r   pytest_cmdline_main   s   rj   c                 C   s   dd l }| jd}|d usJ |j}|| jj  |  |d |  |j	}d}d| }| jj
D ]|}| jj| \}}	}
|	d u rGd}	|d u rRtd| | d|	 d	}|d
|  t|}||d kr|  |j||||dd}|D ]}|| q{q6|d|| d   |j||| dd}|r||d  |dd  D ]	}|||  qq6|  |d g d}|D ]\}}|d|dd|  q|  |  |d |d |d |jdg D ]}|jd|j dd qd S )Nr   terminalreporterzY[pytest] ini-options in the first pytest.ini|tox.ini|setup.cfg|pyproject.toml file found:    stringz!help argument cannot be None for z (z):z  %s   F)initial_indentsubsequent_indentbreak_on_hyphens   )rr   r_   zEnvironment variables:))PYTEST_ADDOPTSzExtra command line options)PYTEST_PLUGINSz.Comma-separated plugins to load during startup)PYTEST_DISABLE_PLUGIN_AUTOLOADz"Set to disable plugin auto-loading)PYTEST_DEBUGz1Set to enable debug tracing of pytest's internals  z<24z/to see available markers type: pytest --markersz1to see available fixtures type: pytest --fixturesz(shown according to specified file_or_dir or current dir if not specified; fixtures with leading '_' are only shown with the '-v' optionwarningsz
warning : T)red)textwraprZ   
get_plugin_twrC   r   	optparserformat_helpre   	fullwidth	_ininames_inidict	TypeErrorlenwrapstatsgetmessage)rH   r{   reportertwcolumns
indent_lenindentr/   r   typer   specspec_len	helplinesre   wrappedvarswarningreportr   r   r   rh      st   


rh   )pytest_pluginszlist of plugin names to loadc                 C   sd   g }| j  }|r0|d |D ]\}}t|dt|}|j d|j d| }|d|  q|S )Nzsetuptools registered plugins:rb   -z at rx   )rZ   list_plugin_distinfor-   r   reprproject_namer+   )rH   linesrd   plugindistloccontentr   r   r   rc      s   

rc   c                 C   s   g }| j js
| j jr|dtj  t| }|r|| | j jrL|d | j	 }|D ]\}}t
|dr;|j}nt|}|d|dd|  q.|S )Nzusing: pytest-zactive plugins:rb   z    z<20z: )rL   r4   traceconfigr-   rO   rP   rc   extendrZ   list_name_pluginhasattrrb   r   )rH   r   verinfoitemsr/   r   rr   r   r   pytest_report_header   s   



r   )r&   argparser   rW   rA   typingr   r   r   r   _pytest.configr   r   r	   _pytest.config.argparsingr
   _pytest.terminalr   rO   r   r;   hookimplr^   rf   intrj   rh   conftest_optionsrS   rc   r   r   r   r   r   <module>   s0   
8 M