o
    h$                     @  s   d 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ZG dd deZd'ddZejddd(ddZd)ddZd*ddZd)dd Zd!gZd+d#d$Zd+d%d&ZdS ),z3Version info, help messages, tracing configuration.    )annotations)Action)	GeneratorN)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__ S/var/www/html/openai_agents/venv/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   r   returnNonec              	   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 |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`. See also --disable-plugin-autoload.)r+   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.)r+   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.)r+   r   r   r   r/   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_addoption/   sj   
	

r:   T)wrapperGenerator[None, Config, Config]c               
   #  s    d V   j jrR 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 d fd
d} |  S )Nwzutf-8)encodingz@versions pytest-{}, python-{}
invocation_dir={}
cwd={}
args={}

.z$writing pytest debug information to 
r&   r'   c                     s6      tjdj d  jjd    d S )Nz"wrote pytest debug information to r@   )closesysstderrwriter.   traceroot	setwriterr   config	debugfileundo_tracingr   r   unset_tracing   s   
z+pytest_cmdline_parse.<locals>.unset_tracing)r&   r'   )optionr3   openrD   formatpytest__version__joinmapstrrB   version_infoinvocation_paramsdirosgetcwdargsrE   rF   rG   pluginmanagerenable_tracingrC   add_cleanup)pathrL   r   rH   r   pytest_cmdline_parsen   s*   


r_   rI   r   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 r@   zpytest )	rM   r*   rB   stdoutrD   rP   rQ   __file__getpluginversioninfo)rI   
plugininfoliner   r   r   showversion   s   rf   int | ExitCode | Nonec                 C  s@   | j jdkrt|  dS | j jr|   t|  |   dS d S )Nr   )rM   r*   rf   r   _do_configureshowhelp_ensure_unconfigure)rI   r   r   r   pytest_cmdline_main   s   rk   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):     F)initial_indentsubsequent_indentbreak_on_hyphens   )rt   r`   zEnvironment variables:))CIzmWhen set (regardless of 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 internalsz<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)textwrapr[   
get_plugin_twrD   r   	optparserformat_helpre   	fullwidth	_ininames_inidict	TypeErrorlenwrapstatsgetmessage)rI   r~   reportertwcolumns
indent_lenindentr.   r   typer   specspec_len	helplinesre   wrappedvarswarningreportr   r   r   ri      st   


ri   )pytest_pluginszlist of plugin names to load	list[str]c                 C  sd   g }| j  }|r0|d |D ]\}}t|dt|}|j d|j d| }|d|  q|S )Nzregistered third-party plugins:rb   -z at rp   )r[   list_plugin_distinfor,   r   reprproject_namer*   )rI   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: )rM   r3   traceconfigr,   rP   rQ   rc   extendr[   list_name_pluginhasattrrb   r   )rI   r   verinfoitemsr.   r   rr   r   r   pytest_report_header	  s   



r   )r   r   r&   r'   )r&   r<   )rI   r   r&   r'   )rI   r   r&   rg   )rI   r   r&   r   )r$   
__future__r   argparser   collections.abcr   rX   rB   _pytest.configr   r   r   _pytest.config.argparsingr   _pytest.terminalr	   rP   r
   r:   hookimplr_   rf   rk   ri   conftest_optionsrc   r   r   r   r   r   <module>   s,   

?
 

R
