HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/testing/__pycache__/fixtures.cpython-310.pyc
o

�$�aA�@s$dZddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
ddlZddlmZddlmZmZd	d
gZdd�Zejd
d�defdd��ZGdd�d�Zejde	dedededede
eeffdd��Zejde	defdd��Zejdd�dede
eefde
dedeeddff
dd��Zejdd�dedefdd ��Zejdd�dedefd!d"��Ze��ded#e	dee
ddffd$d��Zejdefd%d��Z ejd&d'd(�d5d)d*��Z!ejdeddfd+d,��Z"ejd
d�d-e	dd.fd/d��Z#ejd0edd.fd1d2��Z$ejd3d4��Z%dS)6z�
    sphinx.testing.fixtures
    ~~~~~~~~~~~~~~~~~~~~~~~

    Sphinx test fixtures for pytest

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
namedtuple)�StringIO)�PIPE)�Any�Callable�Dict�	Generator�Tuple)�util)�
SphinxTestApp�#SphinxTestAppWrapperForSkipBuildingz�sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None, docutilsconf=None, parallel=0): arguments to initialize the sphinx test application.z0test_params(shared_result=...): test parameters.cCstD]}|�d|�qdS)zRegister custom markers�markersN)�DEFAULT_ENABLED_MARKERS�addinivalue_line)�config�marker�r�9/usr/lib/python3/dist-packages/sphinx/testing/fixtures.py�pytest_configure s�r�session)�scope�returncCsdS�Nrrrrr�rootdir&src@sZeZdZUiZeeeeeffed<dededefdd�Z	dedeee
ffdd�Zd	S)
�SharedResult�cache�key�app_rcCs2||jvrdS|j��|j��d�}||j|<dS)N��status�warning)r�_status�getvalue�_warning)�selfrr�datarrr�store.s
�zSharedResult.storecCs2||jvriS|j|}t|d�t|d�d�S)Nrr r)rr)r$rr%rrr�restore7s



�zSharedResult.restoreN)�__name__�
__module__�__qualname__rr�str�__annotations__rrr&rr'rrrrr+s
	r�request�test_params�
shared_result�sphinx_test_tempdircst|jd�r
|j�d�}n|j�d�}i�i}|dur8tt|��D]}t|j�D]\}}	|	�|<q(|�|j	�q!�fdd�t
����D�}
|drdd|vrRt�
d��|d|d<|�|d�}|�|�|�d	d
�}||�d|�|d<}
|r�|
��s�|d|}|�|
�tdd
�|
|�S)zp
    Parameters that are specified by 'pytest.mark.sphinx' for
    sphinx.application.Sphinx initialization
    �iter_markers�sphinxNcsg|]}�|�qSrr)�.0�i��pargsrr�
<listcomp>Yszapp_params.<locals>.<listcomp>r/�srcdirz:You can not specify shared_result and srcdir in same time.�testroot�rootztest-�
app_paramszargs,kwargs)�hasattr�noder1�
get_marker�reversed�list�	enumerate�args�update�kwargs�sorted�keys�pytest�	Exceptionr'�pop�get�exists�copytreer)r-r.r/r0rr
rD�infor4�arBr'r9r8�
testroot_pathrr5rr;As.




r;cCsjt|jd�r
|j�d�}n|j�d�}|r|jni}ddi}|�|�|dr3t|dt�s3t�	d��|S)au
    Test parameters that are specified by 'pytest.mark.test_params'

    :param Union[str] shared_result:
       If the value is provided, app._status and app._warning objects will be
       shared in the parametrized test functions and/or test functions that
       have same 'shared_result' value.
       **NOTE**: You can not specify both shared_result and srcdir.
    �get_closest_markerr.r/Nz@You can only provide a string type of value for "shared_result" )
r<r=rPr>rDrC�
isinstancer+rGrH)r-�envrD�resultrrrr.qs�

�function�make_appccs��|\}}||i|��}|Vtd|�dd��td|jj�td|j�td|j�tdd|j���td	d|j���|d
rM|�	|d
|�dSdS)z9
    Provides the 'sphinx.application.Sphinx' object
    z# testroot:r9r:z
# builder:z	# srcdir:z	# outdir:z	# status:�
z
# warning:r/N)
�printrJ�builder�namer8�outdirr!r"r#r&)r.r;rUr/rBrDrrrr�app�s��r[cC�|jS�zJ
    Back-compatibility for testing with previous @with_app decorator
    )r!�r[rrrr��rcCr\r])r#r^rrrr �r_r �monkeypatchc#s`�|�ddd��g�tjdd�}��fdd�}|V|tjdd�<t��D]}|��q'dS)z�
    Provides make_app function to initialize SphinxTestApp instance.
    if you want to initialize 'app' in your test function. please use this
    instead of using SphinxTestApp class directory.
    zsphinx.application.abspathcSs|Srr)�xrrr�<lambda>�szmake_app.<locals>.<lambda>NcsRt�t�}}|�d|�|�d|�t|i|��}��|��dr't|�}|S)Nrr r/)r�
setdefaultr�appendr)rBrDrr r��appsr.rr�make�s
zmake_app.<locals>.make)�setattr�sys�pathr?�cleanup)r.r`�syspathrgrrrerrU�s�	
�cCst�Sr)rrrrrr/�s�moduleT)r�autousecCstj��dSr)rr�clearrrrr�_shared_result_cache�srpcCsRt|jdd�}z|rtj|dgttd�WdSWn	ty!Ynwt�d�dS)zt
    The test will be skipped when using 'if_graphviz_found' fixture and graphviz
    dot command is not found.
    �graphviz_dot�z-V)�stdout�stderrNzgraphviz "dot" is not available)�getattrr�
subprocess�runr�OSErrorrG�skip)r[rqrrr�if_graphviz_found�s��rz�tmpdir_factoryz	util.pathcCs|��}t�|���S)z8
    Temporary directory wrapped with `path` class.
    )�getbasetempr
rj�abspath)r{�tmpdirrrrr0�sr~cCs
t�|�S)z�
    Temporary directory wrapped with `path` class.
    This fixture is for back-compatibility with old test implementation.
    )r
rj)r~rrr�tempdir�s
rc
csd�zttj�}dVWttj�D]}||vrtj�|�qdSttj�D]}||vr0tj�|�q$w)z�
    Rollback sys.modules to its value before testing to unload modules
    during tests.

    For example, used in test_ext_autosummary.py to permit unloading the
    target module to clear its cache.
    N)r@ri�modulesrI)�
sysmodules�modnamerrr�rollback_sysmodules�s�	
����r�)rN)&�__doc__rvri�collectionsr�iorr�typingrrrrr	rG�sphinx.testingr
�sphinx.testing.utilrrrr�fixturer+rrr;r.r[rr rUr/rprzr0rr�rrrr�<module>sf
�	
��
�/
��

"