????

Your IP : 3.12.153.221


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/_pytest/__pycache__/debugging.cpython-311.pyc

�

�܋f�4��0�dZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z erddl!m"Z"ddl#m$Z$de%dee%e%ffd�Z&deddfd�Z'deddfd�Z(Gd�d ��Z)Gd!�d"��Z*Gd#�d$��Z+d%�Z,d&�Z-d'ed(ee.d)e de fd*�Z/d(ee.dej0fd+�Z1d,ej0ddfd-�Z2dS).z4Interactive debugging with PDB, the Python Debugger.�N)�Any)�Callable)�	Generator)�List)�Optional)�Tuple)�Type)�
TYPE_CHECKING)�Union)�outcomes)�
ExceptionInfo)�Config)�ConftestImportFailure)�hookimpl)�PytestPluginManager)�Parser)�
UsageError)�Node)�
BaseReport)�CaptureManager)�CallInfo�value�returnc��	|�d��\}}n*#t$r}tj|�d���|�d}~wwxYw||fS)z#Validate syntax of --pdbcls option.�:z) is not in the format 'modname:classname'N)�split�
ValueError�argparse�ArgumentTypeError)r�modname�	classname�es    �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/_pytest/debugging.py�_validate_usepdb_clsr$!so���"�[�[��-�-�����������(��A�A�A�
�
��	���������
�Y��s��
A�=�A�parserc���|�d��}|�dddd���|�ddd	td
���|�dd
dd���dS)N�generalz--pdb�usepdb�
store_truezDStart the interactive Python debugger on errors or KeyboardInterrupt)�dest�action�helpz--pdbcls�
usepdb_clszmodulename:classnamez{Specify a custom interactive Python debugger for use with --pdb.For example: --pdbcls=IPython.terminal.debugger:TerminalPdb)r*�metavar�typer,z--trace�tracez(Immediately break when running each test)�getgroup�
_addoptionr$)r%�groups  r#�pytest_addoptionr4,s����O�O�I�&�&�E�	����
��
S�	����
����
�&�
!�F�����
����
��
7�	�������configc���ddl�|�d��r'|j�t	��d��|�d��r'|j�t��d��tj��j	tj
tjf��tj	�_	|jt_
|t_d�fd�}|�|��dS)	Nrr0�pdbtracer(�	pdbinvokerc�~��tj���\�_t_t_dS�N)�	pytestPDB�_saved�pop�	set_trace�_pluginmanager�_config)�pdbs�r#�finzpytest_configure.<locals>.finUs3���

�� � �"�"�		
��M��$����r5�rN)
rB�getvalue�
pluginmanager�register�PdbTrace�	PdbInvoker<r=�appendr?r@rA�add_cleanup)r6rCrBs  @r#�pytest_configurerLDs�����J�J�J�
���w���>���%�%�h�j�j�*�=�=�=�
���x� � �@���%�%�i�k�k�;�?�?�?�
����	��	�0�)�2C�D�����'�C�M�%�3�I���I��#�#�#�#�#�#����s�����r5c��eZdZUdZdZeeed<dZee	ed<gZ
eee
deeee	fed<dZdZeeeeeefed<ed	ed
deeeffd���Zed	ed
fd
���Zed	ed
fd���Zed���Zedd���ZdS)r<z'Pseudo PDB that defers to the real pdb.Nr@rA).Nr=r�_wrapped_pdb_cls�capmanrrc�2�|r|���SdS)NF)�is_capturing)�clsrOs  r#�
_is_capturingzpytestPDB._is_capturingjs!���	)��&�&�(�(�(��ur5c�^�|jsddl}|jS|j�d��}|jr|jd|kr
|jdS|r�|\}}	t|��tj|}|�d��}t||d��}|dd�D]}	t||	��}�nJ#t$r2}
d�||f��}td|�d|
����|
�d}
~
wwxYwddl}|j}|�
||��}||f|_|S)Nrr-��.rz--pdbcls: could not import z: )rArB�PdbrErN�
__import__�sys�modulesr�getattr�	Exception�joinr�_get_pdb_wrapper_class)
rRrOrBr-r r!�mod�parts�pdb_cls�part�excr�wrapped_clss
             r#�_import_pdb_clszpytestPDB._import_pdb_clspsy���{�	��J�J�J��7�N��[�)�)�,�7�7�
���	+�C�$8��$;�z�$I�$I��'��*�*��	�!+��G�Y�

��7�#�#�#��k�'�*��"����,�,��!�#�u�Q�x�0�0��!�!�"�"�I�5�5�D�%�g�t�4�4�G�G�5���
�
�
����'�9�!5�6�6�� �B�%�B�B�S�B�B���������
����
�J�J�J��g�G��0�0��&�A�A�� *�K�8����s�A)C�
D�-C;�;Dc�8����ddl�G���fd�d|��}|S)Nrc�h���eZdZ�ZdZ��fd�Z���fd�ZexZZ��fd�Z	e	Z
e	Z�fd�Z�fd�Z
�xZS)�:pytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapperFc����xjdz
c_t���|��}�xjdzc_|S)NrU)�_recursive_debug�super�do_debug��self�arg�ret�	__class__rRs   ��r#rlzCpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_debug�sG����$�$��)�$�$��g�g�&�&�s�+�+���$�$��)�$�$��
r5c�T��t���|��}�jdkrĉj�J��j��j��}|���|j}t�	|��}|rO|dkr|�
dd��n|�
dd|z��|�J�|���n|�
dd���j�J��jj
��j|���d|_|S)	Nr�global�>z#PDB continue (IO-capturing resumed)z*PDB continue (IO-capturing resumed for %s)zPDB continue�r6rBT)rk�do_continuerjrAr6�create_terminal_writer�line�_pytest_capmanr<rS�sep�resumer@�hook�pytest_leave_pdb�
_continued)	rnrorp�twrO�	capturingrq�_pytestrRs	      ���r#rvzFpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_continue�s2����g�g�)�)�#�.�.���'�1�,�,��;�2�2�2� ��>�>�s�{�K�K�B��G�G�I�I�I�!�0�F� )� 7� 7�� ?� ?�I� �4�$��0�0��F�F�3�(M�N�N�N�N��F�F� #� L�"+�!,����
 &�1�1�1��
�
��������s�N�3�3�3��)�5�5�5��"�'�8�8���QU�8�V�V�V�"&����
r5c���t���|��}�jdkrtjd��|S)aRaise Exit outcome when quit command is used in pdb.

                This is a bit of a hack - it would be better if BdbQuit
                could be handled, but this would require to wrap the
                whole pytest run, and adjust the report etc.
                r�Quitting debugger)rk�do_quitrjr�exitrms   ��r#r�zBpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.do_quit�s>����g�g�o�o�c�*�*���'�1�,�,��M�"5�6�6�6��
r5c���t���||��}|s)|jr"|jr|j�d���|S)z�Suspend on setup().

                Needed after do_continue resumed, and entering another
                breakpoint again.
                T��in_)rk�setupr~ry�suspend_global_capture)rn�f�tbrprqs    �r#r�z@pytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.setup�s\����g�g�m�m�A�r�*�*���M�t��M��*�M��+�B�B�t�B�L�L�L��
r5c�H��t���||��\}}|�wtdt|��dz
��}|rU||dj�dd��r.|dz}|r'||dj�dd���.||fS)NrrU�__tracebackhide__F)rk�	get_stack�max�len�f_locals�get)rnr��t�stack�irqs     �r#r�zDpytestPDB._get_pdb_wrapper_class.<locals>.PytestPdbWrapper.get_stack�s���� �7�7�,�,�Q��2�2���q��9��A�s�5�z�z�A�~�.�.�A����a���� 4� 8� 8�9L�e� T� T���Q������a���� 4� 8� 8�9L�e� T� T���a�x�r5)�__name__�
__module__�__qualname__ryr~rlrv�do_c�do_contr��do_q�do_exitr�r��
__classcell__)rqr�rOrRs@���r#�PytestPdbWrapperrh�s���������#�N��J�
�
�
�
�
�
�
�
�
�
�
�
�
�6)�(�D�7�
�
�
�
�
�
��D��G�
�
�
�
�
�
 �
 �
 �
 �
 �
 �
 �
 �
 r5r�)�_pytest.config)rRrarOr�r�s` ` @r#r^z pytestPDB._get_pdb_wrapper_class�sd���������M	 �M	 �M	 �M	 �M	 �M	 �M	 �M	 �M	 �w�M	 �M	 �M	 �^ �r5c���ddl}|j�d}n|j�d��}|r|�d���|jr�|j�|j��}|���|jdkr�|�	dd��}|�|�
d|��no|�|��}|dkr|�
dd	|�d
���n9|r|�
dd	|�d|�d���n|�
dd	|����|�|��di|��}	|jr&|jj
�|j|	�
��|	S)z4Initialize PDB debugging, dropping any IO capturing.rN�capturemanagerTr��headerrtrszPDB z (IO-capturing turned off)z (IO-capturing turned off for �)ru�)r�r@�	getplugin�suspendrAr6rwrxrjr>rzrSrer|�pytest_enter_pdb)
rR�method�args�kwargsr�rOrr�r��_pdbs
          r#�	_init_pdbzpytestPDB._init_pdb�s���	������%�/3�F�F��'�1�1�2B�C�C�F��	%��N�N�t�N�$�$�$��;�	5���6�6�s�{�C�C�B��G�G�I�I�I��#�q�(�(����H�d�3�3���%��F�F�3��'�'�'�'� #� 1� 1�&� 9� 9�I� �H�,�,����s�$M�6�$M�$M�$M�N�N�N�N�"�5�����C�%�v�v�y�y�y�2��������s�O�6�O�O�4�4�4�*�s�"�"�6�*�*�4�4�V�4�4����	S���#�4�4�C�K�T�4�R�R�R��r5c��tj��j}|jdg|�Ri|��}|�|��dS)zBInvoke debugging via ``Pdb.set_trace``, dropping any IO capturing.r?N)rY�	_getframe�f_backr�r?)rRr�r��framer�s     r#r?zpytestPDB.set_tracesK���
���&���s�}�[�:�4�:�:�:�6�:�:�����u�����r5rD)r�r�r��__doc__r@rr�__annotations__rArr=rrrrjrNr	r�classmethodr�str�boolrSrer^r�r?r�r5r#r<r<_s��������1�1�48�N�H�0�1�8�8�8� $�G�X�f�
�$�$�$�	��D�
�h�y�!�8�,?�#@�(�6�BR�R�S�
������>B��h�u�T�#�Y��S�	�%9�:�;�B�B�B���8�,<�#=��%��T�	�BR�����[��
�$�X�.>�%?�$�$�$��[�$�L�T �X�>N�5O�T �T �T ��[�T �l�%�%��[�%�N�����[���r5r<c�B�eZdZdedddeddfd�Zdeeddfd	�ZdS)
rI�node�callz
CallInfo[Any]�reportrNc��|jj�d��}|rk|�d���|���\}}t
j�|��t
j�|��|j�J�t|jj
tj��st||j|��dSdS)Nr�Tr�)r6rFr�r��read_global_capturerY�stdout�write�excinfo�
isinstancer�unittest�SkipTest�
_enter_pdb)rnr�r�r�rO�out�errs       r#�pytest_exception_interactz#PdbInvoke.pytest_exception_interacts�����*�4�4�5E�F�F���	"��)�)�d�)�3�3�3��1�1�3�3�H�C���J���S�!�!�!��J���S�!�!�!��|�'�'�'��$�,�,�h�.?�@�@�	3��t�T�\�6�2�2�2�2�2�	3�	3r5r�c�B�t|��}t|��dSr;)�_postmortem_traceback�post_mortem)rnr�r�s   r#�pytest_internalerrorzPdbInvoke.pytest_internalerror-s��
"�7�
+�
+���B�����r5)	r�r�r�rrr�r
�
BaseExceptionr�r�r5r#rIrIso������3��3� /�3�9C�3�	
�3�3�3�3��M�-�,H��T������r5rIc�J�eZdZed���dedfd���ZdS)rHT)�hookwrapperr)NNNc#�0K�t|��dV�dSr;)� wrap_pytest_function_for_tracing)rn�
pyfuncitems  r#�pytest_pyfunc_callzPdbTrace.pytest_pyfunc_call3s!����(��4�4�4�
�����r5N)r�r�r�rrr�r�r5r#rHrH2sM������
�X�$�����	�:J�0K���� ����r5rHc����t�d���|j�tj�����fd���}||_dS)z�Change the Python function object of the given Function item by a
    wrapper which actually enters pdb before calling the python function
    itself, effectively leaving the user in the pdb prompt in the first
    statement of the function.�runcallc�\��tj�g|�Ri|��}��|��dSr;)�	functools�partialr�)r�r��funcr��testfunctions   ��r#�wrapperz1wrap_pytest_function_for_tracing.<locals>.wrapperDs;���� ��?��?�?�?��?�?�����T�����r5N)r<r��objr��wraps)r�r�r�r�s  @@r#r�r�9sb����
���y�)�)�D��>�L�
�_�\�"�"������#�"���J�N�N�Nr5c�\�|j�d��rt|��dSdS)zaWrap the given pytestfunct item for tracing support if --trace was given in
    the command line.r0N)r6rEr�)r�s r#�&maybe_wrap_pytest_function_for_tracingr�Ls;����!�!�'�*�*�5�(��4�4�4�4�4�5�5r5r�r��repc�@�|jj�d��j}|���|jjj}d|jfd|jfd|j	ffD]S\}}||dfvrH|rF|�
dd|z��|dd�d	kr
|dd�}|�|���T|�
dd
��|�|��|�
dd��t|��}d|_
t|��|S)
N�terminalreporterr��stderr�log�allrtz	captured ����
�	tracebackzentering PDBT)r6rFr��_twrx�option�showcapture�	capstdout�	capstderr�caplogrz�
toterminalr��	_pdbshownr�)r�r�r�rr��sectionname�contentr�s        r#r�r�Ss1��
��	"�	,�	,�-?�	@�	@�	D�B��G�G�I�I�I��+�$�0�K�
�3�=�!�	�3�=�!�	��
��!�	�	���W�
�;��.�.�.�7�.��F�F�3��k�1�2�2�2��r�s�s�|�t�#�#�!�#�2�#�,���G�G�G������F�F�3������N�N�2�����F�F�3�����	�w�	'�	'�B��C�M���O�O�O��Jr5c���ddlm}t|j|��r|jjdSt|jt
��r|jjdS|j�J�|jdS)Nr)�UnexpectedException�)�doctestr�r�r�exc_inforr��_excinfo)r�r�s  r#r�r�rs��+�+�+�+�+�+��'�-�!4�5�5�
#��}�%�a�(�(�	�G�M�#8�	9�	9�#��}�$�Q�'�'���+�+�+����"�"r5r�c���t�d��}|���|�d|��|jrtjd��dSdS)Nr�r�)r<r��reset�interaction�quittingrr�)r��ps  r#r�r��sa�����M�*�*�A��G�G�I�I�I��M�M�$������z�+��
�)�*�*�*�*�*�+�+r5)3r�rr�rY�typesr��typingrrrrrrr	r
rr�r�
_pytest._coder
r�rrrr�_pytest.config.argparsingr�_pytest.config.exceptionsr�
_pytest.nodesr�_pytest.reportsr�_pytest.capturer�_pytest.runnerrr�r$r4rLr<rIrHr�r�r�r��
TracebackTyper�r�r�r5r#�<module>rs\��:�:���������
�
�
�
��������������������������������������������������� � � � � � �������������'�'�'�'�'�'�!�!�!�!�!�!�0�0�0�0�0�0�#�#�#�#�#�#�.�.�.�.�.�.�,�,�,�,�,�,�0�0�0�0�0�0�������&�&�&�&�&�&��(�.�.�.�.�.�.�'�'�'�'�'�'� �� ��c�3�h�� � � � ��V�������0�V�������6|�|�|�|�|�|�|�|�~��������(�����������&5�5�5��
��&�}�5��<F�������>
#�=��#?�
#�E�DW�
#�
#�
#�
#� +�5�&�+�4�+�+�+�+�+�+r5