
    zi#'                    "   d Z ddlmZ ddl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Z G d dej                  Zd dZ ej        d          d!d            Zd"dZd#dZd"dZd$dZd$dZdS )%z3Version info, help messages, tracing configuration.    )annotationsN)	Generator)Sequence)Any)Config)ExitCode)	PrintHelp)Parser)TerminalReporterc                  6     e Zd ZdZddd fdZ	 dddZ xZS )
HelpActiona2  An argparse Action that will raise a PrintHelp exception in order to skip
    the rest of the argument parsing when --help is passed.

    This prevents argparse from raising UsageError when `--help` is used along
    with 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.

    To opt in to this behavior, the parse caller must set
    `namespace._raise_print_help = True`. Otherwise it just sets the option.
    N)helpoption_stringsSequence[str]deststrr   
str | NonereturnNonec               V    t                                          ||ddd|           d S )Nr   TF)r   r   nargsconstdefaultr   )super__init__)selfr   r   r   	__class__s       U/root/projects/openclaw-proxy/venv/lib/python3.11/site-packages/_pytest/helpconfig.pyr   zHelpAction.__init__"   sB     	) 	 	
 	
 	
 	
 	
    parserargparse.ArgumentParser	namespaceargparse.Namespacevaluesstr | Sequence[Any] | Noneoption_stringc                l    t          || j        | j                   t          |dd          rt          d S )N_raise_print_helpF)setattrr   r   getattrr	   )r   r    r"   r$   r&   s        r   __call__zHelpAction.__call__.   s>     		49dj11191599 	O	 	r   )r   r   r   r   r   r   r   r   )N)
r    r!   r"   r#   r$   r%   r&   r   r   r   )__name__
__module____qualname____doc__r   r+   __classcell__)r   s   @r   r   r      sv        
 
 OS

 

 

 

 

 

 

 

" %)
 
 
 
 
 
 
 
 
r   r   r    r
   r   r   c           	        |                      d          }|                    dddddd           |                    d	d
t          dd           |                    dddg dd           |                    dddd           |                    ddddd           |                    ddddd d!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)r5   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`. See also --disable-plugin-autoload.)r5   r   r   metavarr   z--disable-plugin-autoload
store_trueFzDisable plugin auto-loading through entry point packaging metadata. Only plugins explicitly specified in -p or env var PYTEST_PLUGINS will be loaded.)r5   r   r   z--traceconfigz--trace-configz)Trace considerations of conftest.py filesz--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.)r5   r   r   r   r9   r   z-oz--override-inioverride_inizhOverride configuration option with "option=value" style, e.g. `-o strict_xfail=True -o cache_dir=cache`.)r   r5   r   )getgroup	addoption
_addoptionr   )r    groups     r   pytest_addoptionrD   ;   sj   OOM**E	OOD     
7     
<  	 	 	 
OO#\	     
OO8     
OO!$  
 
 
 
:      r   T)wrapperGenerator[None, Config, Config]c               #  ~  K   d V j         j        r&j         j        } t          | dd                              d                    t
          j        d                    t          t          t          j                            j        j        t          j                    j        j                             j        j                            j                   j                                        t          j                            d|  d           dfd
}                    |           S )Nwzutf-8)encodingz@versions pytest-{}, python-{}
invocation_dir={}
cwd={}
args={}

.z$writing pytest debug information to 
r   r   c                                                       t          j                            dj         d            j        j                            d                          d S )Nz"wrote pytest debug information to rK   )closesysstderrwriter8   traceroot	setwriter)config	debugfileundo_tracings   r   unset_tracingz+pytest_cmdline_parse.<locals>.unset_tracing   s_    OOJT).TTTUUUL''---LNNNNNr   )r   r   )optionr=   openrP   formatpytest__version__joinmapr   rN   version_infoinvocation_paramsdirosgetcwdargsrQ   rR   rS   pluginmanagerenable_tracingrO   add_cleanup)pathrW   rT   rU   rV   s     @@@r   pytest_cmdline_parseri   z   s=     UUF} *}"sW555	@@F"S#"23344(,	(-A A		
 		
 		
 	##IO444+::<<
HHHHIII	 	 	 	 	 	 	 	 	=)))Mr   rT   r   c                    t           j                            dt          j         dt          j         d           t          |           }|r'|D ]&}t           j                            |dz              %dS dS )z<Show verbose pytest version installation, including plugins.zThis is pytest version z, imported from rK   N)rN   stdoutrP   r[   r\   __file__getpluginversioninfo)rT   
plugininfolines      r   show_version_verboserp      s    JY&"4YYfoYYY   &f--J * 	* 	*DJTD[))))* *	* 	*r   int | ExitCode | Nonec                    | j         j        dk    rt          |            t          j        S | j         j        rC|                                  t          |            |                                  t          j        S d S )N   )	rX   r4   rp   r   OKr   _do_configureshowhelp_ensure_unconfigure)rT   s    r   pytest_cmdline_mainrx      sv     }q  V$$${		 ""$$${4r   c                   dd l }| j                            d          }|J |j        }|                    | j        j                                                   |                                 |                    d           |                                 |j	        }d}d|z  }| j        j
        D ])}| j        j
        |         \  }}	}
|t          d|           | d|	 d}|                    d	|            t          |          }||d
z
  k    rI|                                 |                    ||||d          }|D ]}|                    |           |                    d||z
  dz
  z             |                    |||z
  d          }|r@|                    |d                    |dd          D ]}|                    ||z              +|                                 |                    d           g d}|D ]!\  }}|                    d	|dd|            "|                                 |                                 |                    d           |                    d           |                    d           |j                            dg           D ]!}|                    d|j        z   d           "d S )Nr   terminalreporterzo[pytest] configuration options in the first pytest.toml|pytest.ini|tox.ini|setup.cfg|pyproject.toml file found:    z!help argument cannot be None for z (z):     F)initial_indentsubsequent_indentbreak_on_hyphens   )r   rs   zEnvironment variables:)	)CIzlWhen set to a non-empty value, pytest knows it is running in a CI process and does not truncate summary info)BUILD_NUMBERzEquivalent to CI)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)PYTEST_DEBUG_TEMPROOTz'Override the system temporary directory)PYTEST_THEMEz)The Pygments style to use for code output)PYTEST_THEME_MODEz3Set the PYTEST_THEME to be either 'dark' or 'light'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)textwrapre   
get_plugin_twrP   _parser	optparserformat_helpro   	fullwidth_inidict	TypeErrorlenwrapstatsgetmessage)rT   r   reportertwcolumns
indent_lenindentr8   r   type_defaultspecspec_len	helplinesro   wrappedvarswarningreports                     r   rv   rv      s@   OOO(.(<(G(G) )H 	BHHV^%1133444GGIIIGG	N   GGIIIlGJ:F' + +%~6t<dH<FFFGGG""$"""
dt99zA~&&GGIII %"(!& &  I "   HHSJ1A56777mmD'J*>QVmWWG +
####ABBK + +DGGFTM****GGIIIGG$%%%  D  ( (
d
&T&&&&&''''GGIIIGGIIIGG=>>>GG?@@@GG	   "++J;; @ @
}44$????@ @r   	list[str]c                   g }| j                                         }|rg|                    d           |D ]O\  }}t          |dt	          |                    }|j         d|j         d| }|                    d|z              P|S )Nzregistered third-party plugins:rl   -z at r}   )re   list_plugin_distinfor6   r*   reprproject_namer4   )rT   linesrn   plugindistloccontents          r   rm   rm     s    E%::<<J )6777& 	) 	)LFD&*d6ll;;C*DDT\DDsDDGLL((((Lr   c                   g }| j         j        s| j         j        rH|                    dt          j                    t          |           }|r|                    |           | j         j        ry|                    d           | j        	                                }|D ]H\  }}t          |d          r|j        }nt          |          }|                    d|dd|            I|S )Nzusing: pytest-zactive plugins:rl   z    z<20z: )rX   r=   traceconfigr6   r[   r\   rm   extendre   list_name_pluginhasattrrl   r   )rT   r   verinfoitemsr8   r   rs          r   pytest_report_headerr     s    E} "fm7 ":f&8::;;;&v.. 	"LL!!!}  1&'''$5577! 	1 	1LD&vz** !OLLLL////A//0000Lr   )r    r
   r   r   )r   rF   )rT   r   r   r   )rT   r   r   rq   )rT   r   r   r   )r/   
__future__r   argparsecollections.abcr   r   rb   rN   typingr   _pytest.configr   r   r	   _pytest.config.argparsingr
   _pytest.terminalr   r[   Actionr   rD   hookimplri   rp   rx   rv   rm   r    r   r   <module>r      s   9 9 " " " " " "  % % % % % % $ $ $ $ $ $ 				 



       ! ! ! ! ! ! # # # # # # $ $ $ $ $ $ , , , , , , - - - - - - # # # # # # # #L< < < <~    @* * * *   P@ P@ P@ P@f	 	 	 	     r   