????

Your IP : 3.147.70.194


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__/pytester.cpython-311.pyc

�

�܋f��	���dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl%m&Z&ddl%m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl.m0Z0ddl.m1Z1ddl2m3Z3ddl2m4Z4dd l2m5Z5dd!l2m6Z6dd"l2m7Z7dd#l2m8Z8dd$l9m:Z:dd%l;m<Z<dd&l=m>Z>dd'l=m?Z?dd(l@mAZAdd)lBmCZCdd*lDmEZEdd+lDmFZFdd,lGmHZHdd-lGmIZIdd.lGmJZJdd/lKmLZLdd0lKmMZMdd1lKmNZNdd2lOmPZPdd3lOmQZQdd4lRmSZSdd5lTmUZUe!rdd6lVmWZWdd7lVmXZXddlYZYd8gZZd9gZ[d:e:d;dfd<�Z\d=e4d;dfd>�Z]Gd?�d@��Z^e>dAe?d;dBfdC���Z(GdD�dB��Z_dEee`d;ee`fdF�Zae/GdG�dH����Zbe/GdI�dJ����Zce>dddL���Zde>dM�N��dAe?d;e dMfdO���Zee>dAe?dPeSdQeCd;dRfdS���Zfe>d;edTfdU���Zge>d;ee4ddffdV���Zhe	jidW��Zje	jidX��Zke/GdY�dZ����ZlGd[�d\��ZmGd]�d^��ZnGd_�d`��Zoe/Gda�dR����ZpGdb�dK��ZqGdc�dM��ZrdS)ezZ(Disabled by default) support for testing pytest and pytest plugins.

PYTEST_DONT_REWRITE
�N)�fnmatch)�StringIO)�Path)�Any)�Callable)�Dict)�	Generator)�IO)�Iterable)�List)�Optional)�overload)�Sequence)�TextIO)�Tuple)�Type)�
TYPE_CHECKING)�Union)�WeakKeyDictionary)�	IniConfig)�SectionWrapper)�timing)�Source)�_get_multicapture)�final)�NOTSET)�
NotSetType)�
_PluggyPlugin)�Config)�ExitCode)�hookimpl)�main)�PytestPluginManager)�Parser)�check_ispytest)�fixture)�FixtureRequest)�Session)�MonkeyPatch)�	Collector)�Item)�fail)�importorskip)�skip)�bestrelpath)�copytree)�make_numbered_dir)�
CollectReport)�
TestReport)�TempPathFactory)�
PytestWarning)�Final)�Literal�pytester_assertionsz/var/lib/sss/mc/passwd�parser�returnc��|�ddddd���|�ddd	d
d���|�d
d���dS)Nz--lsof�
store_true�lsofFz"Run FD checks if lsof is available)�action�dest�default�help�--runpytest�	inprocess�	runpytest)rC�
subprocesszYRun pytest sub runs in tests using an 'inprocess' or 'subprocess' (python -m main) method)r@r?�choicesrA�pytester_example_dirz1Directory to take the pytester example files from)rA)�	addoption�addini)r9s �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/_pytest/pytester.py�pytest_addoptionrKWs���
�����
��
1����������
�+�
6�
�	�	�	��M�M��%X��������configc���|�d��r<t��}|���r|j�|��|�dd��dS)Nr=�markerszlpytester_example_path(*path_segments): join the given path segments to `pytester_example_dir` for this test.)�getvalue�LsofFdLeakChecker�matching_platform�
pluginmanager�register�addinivalue_line)rM�checkers  rJ�pytest_configurerWpsv��
���v���3�#�%�%���$�$�&�&�	3�� �)�)�'�2�2�2�
����	<�����rLc��eZdZdeeeeffd�Zdefd�Ze	dd���de
dedfd���Zd	S)
rQr:c
��tjdddttj����ftjtjddtjd�����j	}dtdtfd	�}g}|�d
��D]x}||��rk|�d��}|dd
d�}|d
d
d�}|tvr�L|�
d��r|�||f���y|S)Nr=z-Ffn0�-pTF)�stdout�stderr�check�text�encoding�liner:c�L�|�d��od|vod|vod|vod|vS)N�f�deleted�mem�txt�cwd��
startswith)r`s rJ�isopenz0LsofFdLeakChecker.get_open_files.<locals>.isopen�sL���?�?�3�'�'����%�&���%�&���%�&���%�	
rL�
�r��/)rE�run�str�os�getpid�PIPE�DEVNULL�locale�getpreferredencodingr[�bool�split�
IGNORE_PAMrh�append)�self�outri�
open_filesr`�fields�fd�filenames        rJ�get_open_filesz LsofFdLeakChecker.get_open_files~s!���n�
�W�d�C��	���$4�$4�5��?��%����0��7�7�

�
�
��	�	��	��	�	�	�	��
��I�I�d�O�O�	6�	6�D��v�d�|�|�
6����D�)�)���A�Y�q�r�r�]��!�!�9�Q�R�R�=���z�)�)���&�&�s�+�+�6��%�%�r�8�n�5�5�5���rLc�n�	tjdd���dS#ttjf$rYdSwxYw)N)r=z-vT)r]F)rErn�OSError�CalledProcessError�rzs rJrRz#LsofFdLeakChecker.matching_platform�sO��	��N�>��6�6�6�6��4����6�7�	�	�	��5�5�	���s��4�4T)�hookwrapper�tryfirst�item�NNNc#�&�K�|���}dV�ttd��rtj��|���}d�|D��d�|D��z
��fd�|D��}|r�dt|��zgd�|D���d�d�|D���d	�d
�|D���dt|��z�d|jz�d�}|�td
�	|������dSdS)N�pypy_version_infoc��h|]
}|d��S�r���.0�ts  rJ�	<setcomp>z<LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<setcomp>�s��(�(�(�A�1�Q�4�(�(�(rLc��h|]
}|d��Sr�r�r�s  rJr�z<LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<setcomp>�s��+A�+A�+A�Q�A�a�D�+A�+A�+ArLc�(��g|]}|d�v�|��Sr�r�)r�r��new_fdss  �rJ�
<listcomp>z=LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<listcomp>�s"���=�=�=�a�Q�q�T�W�_�_��_�_�_rLz***** %s FD leakage detectedc3�4K�|]}t|��V��dS�N�ro�r�rbs  rJ�	<genexpr>z<LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<genexpr>�s(����/�/�Q�#�a�&�&�/�/�/�/�/�/rLz*** Before:c3�4K�|]}t|��V��dSr�r�r�s  rJr�z<LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<genexpr>��(����)�)�Q�#�a�&�&�)�)�)�)�)�)rLz
*** After:c3�4K�|]}t|��V��dSr�r�r�s  rJr�z<LsofFdLeakChecker.pytest_runtest_protocol.<locals>.<genexpr>�r�rLz*** function %s:%s: %s zSee issue #2366rj)
r��hasattr�sys�gc�collect�len�location�warnr5�join)rzr��lines1�lines2�leaked_files�errorr�s      @rJ�pytest_runtest_protocolz)LsofFdLeakChecker.pytest_runtest_protocol�ss������$�$�&�&��
�����3�+�,�,�	��J�L�L�L��$�$�&�&��(�(��(�(�(�+A�+A�&�+A�+A�+A�A��=�=�=�=�6�=�=�=���	7�.��\�1B�1B�B�
�/�/�,�/�/�/�
��
�*�)�&�)�)�)�	
�
�
�*�)�&�)�)�)�
�/��\�1B�1B�B�
�*�D�M�9�
�"�
�E�
�I�I�m�D�I�I�e�$4�$4�5�5�6�6�6�6�6�	7�	7rLN)
�__name__�
__module__�__qualname__rrror�rvrRr!r+r	r�r�rLrJrQrQ}s���������U�3��8�_� 5�����@�4������X�$��.�.�.�7�D�7�Y�?O�5P�7�7�7�/�.�7�7�7rLrQ�request�	PytestArgc� �t|��S)z�Return a helper which offers a gethookrecorder(hook) method which
    returns a HookRecorder instance which helps to make assertions about called
    hooks.)r��r�s rJ�_pytestr��s��
�W���rLc�&�eZdZdeddfd�Zdd�ZdS)r�r�r:Nc��||_dSr�)�_request)rzr�s  rJ�__init__zPytestArg.__init__�s
����
�
�
rL�HookRecorderc�l�t|j��}|j�|j��|Sr�)r��_pmr��addfinalizer�finish_recording)rz�hook�hookrecorders   rJ�gethookrecorderzPytestArg.gethookrecorder�s0��#�D�H�-�-���
�"�"�<�#@�A�A�A��rL)r:r�)r�r�r�r'r�r�r�rLrJr�r��sJ������ �� �4� � � � ������rL�valuesc��d�|D��S)zDOnly return names from iterator values without a leading underscore.c�*�g|]}|ddk�|��S)r�_r��r��xs  rJr�z$get_public_names.<locals>.<listcomp>�s!��-�-�-�!��1�����A���rLr�)r�s rJ�get_public_namesr��s��-�-�v�-�-�-�-rLc�B�eZdZdZdeddfd�Zdefd�Zerdefd�ZdSdS)	�RecordedHookCalla;A recorded call to a hook.

    The arguments to the hook call are set as attributes.
    For example:

    .. code-block:: python

        calls = hook_recorder.getcalls("pytest_runtest_setup")
        # Suppose pytest_runtest_setup was called once with `item=an_item`.
        assert calls[0].item is an_item
    �namer:Nc�H�|j�|��||_dSr�)�__dict__�update�_name)rzr��kwargss   rJr�zRecordedHookCall.__init__�s#���
���V�$�$�$���
�
�
rLc�V�|j���}|d=d|j�d|�d�S)Nr�z<RecordedHookCall z(**z)>)r��copyr�)rz�ds  rJ�__repr__zRecordedHookCall.__repr__�s7���M��� � ��
�g�J�<�D�J�<�<�Q�<�<�<�<rL�keyc��dSr�r�)rzr�s  rJ�__getattr__zRecordedHookCall.__getattr__�s���CrL)	r�r�r��__doc__ror�r�rr�r�rLrJr�r��s�������
�
��S��T�����=�#�=�=�=�=�
��	�3�	�	�	�	�	�	��rLr�c���eZdZdZdd�dededdfd�Zd*d	�Zd
ee	e
e	fdeefd�Z
deee	e	fddfd
�Zde	defd�Zde	defd�Zed
ddeefd���Zed
ddeefd���Ze	d+d
ee	e
e	fdeeeeffd���Z	d+d
ee	e
e	fdeeeeffd�Z			d,de	d
ee	e
e	fdee	deeeffd�Zed
ddeefd���Zed
ddeefd���Ze	d+d
ee	e
e	fdeeeeffd���Z	d+d
ee	e
e	fdeeeeffd �Zdeefd!�Zdeeeeeeefeeeefffd"�Zdeefd#�Zd-d%ed&ed'eddfd(�Zd*d)�ZdS).r�z�Record all hooks called in a plugin manager.

    Hook recorders are created by :class:`Pytester`.

    This wraps all the hook calls in the plugin manager, recording each call
    before propagating the normal calls.
    F��	_ispytestrSr�r:Nc���t|��|�_g�_d�_dtddf�fd�}dtddfd�}|�||���_dS)N�	hook_namer:c�X���j�t||����dSr�)�callsryr�)r��
hook_implsr�rzs   �rJ�beforez%HookRecorder.__init__.<locals>.before	s*����J���.�y�&�A�A�B�B�B�B�BrLc��dSr�r�)�outcomer�r�r�s    rJ�afterz$HookRecorder.__init__.<locals>.afters���DrL)r%�_pluginmanagerr��retro�add_hookcall_monitoring�_undo_wrapping)rzrSr�r�r�s`    rJr�zHookRecorder.__init__s����	�y�!�!�!�+���-/��
�37���	C�c�	C�$�	C�	C�	C�	C�	C�	C�	�c�	�$�	�	�	�	�,�C�C�F�E�R�R����rLc�.�|���dSr�)r�r�s rJr�zHookRecorder.finish_recordings���������rL�namesc�|��t�t��r������fd�|jD��S)z?Get all recorded calls to hooks with the given names (or name).c�&��g|]
}|j�v�|��Sr�)r�)r��callr�s  �rJr�z)HookRecorder.getcalls.<locals>.<listcomp>s%���C�C�C��t�z�U�/B�/B��/B�/B�/BrL)�
isinstancerorwr��rzr�s `rJ�getcallszHookRecorder.getcallss>����e�S�!�!�	"��K�K�M�M�E�C�C�C�C���C�C�C�CrL�entriesc�$�d}d}t|��}tjd��j}|r�|�d��\}}t|j|d���D]�\}}|j|krqtd||��t|||j
��r tdt|��d|��n tdt|��d|���w||dzz
}n(td	|d
|����td|�d|����|��dSdS)
NTrrl�	NAMEMATCH�CHECKERMATCHz->�NOCHECKERMATCH�-�NONAMEMATCH�withzcould not find z check )
�listr��	_getframe�f_locals�pop�	enumerater�r��print�evalr��reprr,)	rzr��__tracebackhide__�i�
backlocalsr�r]�indr�s	         rJ�assert_containszHookRecorder.assert_containssH�� ��
���w�-�-���]�1�%�%�.�
��	A�!�+�+�a�.�.�K�D�%�&�t�z�!�"�"�~�6�6�
A�
A�	��T��:��%�%��+�t�T�2�2�2��E�:�t�}�=�=�!��n�d�5�k�k�4��F�F�F�F��.��U���S�$�G�G�G� ���q��L�A��E��m�T�6�4�8�8�8�8��?�t�?�?�e�?�?�@�@�@��	A�	A�	A�	A�	ArLr�c��d}t|j��D]\}}|j|kr|j|=|cS�d|�d�g}|�d�|jD����t	d�|����dS)NTzcould not find call z, in:c��g|]}d|z��S)z  %sr�r�s  rJr�z(HookRecorder.popcall.<locals>.<listcomp>6s��5�5�5�Q�f�q�j�5�5�5rLrj)r�r�r��extendr,r�)rzr�r�r�r��liness      rJ�popcallzHookRecorder.popcall/s��� �� ���,�,�	�	�G�A�t��z�T�!�!��J�q�M�����"�6��5�5�5�6��
���5�5�$�*�5�5�5�6�6�6��T�Y�Y�u�
�
�����rLc�z�|�|��}t|��dksJ||f���|dS)Nrlr)r�r�)rzr�r�s   rJ�getcallzHookRecorder.getcall9s@�����t�$�$���6�{�{�a����$�������a�y�rLzLiteral['pytest_collectreport']c��dSr�r�r�s  rJ�
getreportszHookRecorder.getreports@�	��
	�rLz#Literal['pytest_runtest_logreport']c��dSr�r�r�s  rJrzHookRecorder.getreportsGrrL��pytest_collectreport�pytest_runtest_logreportc��dSr�r�r�s  rJrzHookRecorder.getreportsN�	��	�rLc�@�d�|�|��D��S)Nc��g|]	}|j��
Sr�)�reportr�s  rJr�z+HookRecorder.getreports.<locals>.<listcomp>_s��7�7�7�Q���7�7�7rL)r�r�s  rJrzHookRecorder.getreportsXs$��8�7�$�-�-��"6�"6�7�7�7�7rL��rr�	inamepart�whenc��g}|�|���D]X}|s|jdkr|jr�|r|j|kr�%|r||j�d��vr|�|���Y|st
d|�d����t|��dkr#t
d�||�����|dS)	z5Return a testreport whose dotted import path matches.)r�r��::z$could not find test report matching z: no test reports at all!rlz-found 2 or more testreports matching {!r}: {}r)	rr�passed�nodeidrwry�
ValueErrorr��format)rzrr�rr��reps      rJ�matchreportzHookRecorder.matchreportas������?�?��?�/�/�	#�	#�C��
�C�H��.�.�3�:�.���
���D�(�(���
#�	�S�Z�-=�-=�d�-C�-C� C� C��
�
�c�"�"�"���	��*�-6�Y�Y�9���
��v�;�;��?�?��?�F�F��v�����
�
�a�y�rLc��dSr�r�r�s  rJ�getfailureszHookRecorder.getfailures�rrLc��dSr�r�r�s  rJr#zHookRecorder.getfailures�rrLc��dSr�r�r�s  rJr#zHookRecorder.getfailures�rrLc�@�d�|�|��D��S)Nc� �g|]}|j�	|��Sr�)�failed)r�r s  rJr�z,HookRecorder.getfailures.<locals>.<listcomp>�s��D�D�D����D��D�D�DrL)rr�s  rJr#zHookRecorder.getfailures�s%��E�D�t���u�5�5�D�D�D�DrLc�,�|�d��S)Nr)r#r�s rJ�getfailedcollectionsz!HookRecorder.getfailedcollections�s����� 6�7�7�7rLc�R�g}g}g}|�d��D]�}|jr8|jdkr,t|t��sJ�|�|���A|jr|�|���^|js
Jd|�����|�|����|||fS)Nrr�zUnexpected outcome: )rrrr�r3ry�skippedr()rzrr,r(r s     rJ�listoutcomeszHookRecorder.listoutcomes�s����������?�?�@�
�
�	#�	#�C��z�
#��8�v�%�%�%�c�:�6�6�6�6�6��M�M�#�&�&�&����
#����s�#�#�#�#��z�A�A�#A�#�#A�#A�A�A�z��
�
�c�"�"�"�"��w��&�&rLc�>�d�|���D��S)Nc�,�g|]}t|����Sr�)r�r�s  rJr�z.HookRecorder.countoutcomes.<locals>.<listcomp>�s��4�4�4�1��A���4�4�4rL)r-r�s rJ�
countoutcomeszHookRecorder.countoutcomes�s"��4�4�� 1� 1� 3� 3�4�4�4�4rLrrr,r(c�\�d}ddlm}|���}|||||���dS)NTr)�
assertoutcome)rr,r()�_pytest.pytester_assertionsr2r-)rzrr,r(r�r2�outcomess       rJr2zHookRecorder.assertoutcome�sZ�� ��=�=�=�=�=�=��$�$�&�&���
�����		
�	
�	
�	
�	
�	
rLc��g|jdd�<dSr�)r�r�s rJ�clearzHookRecorder.clear�s����
�1�1�1�
�
�
rL�r:N)r)rrN)rrr) r�r�r�r�r#rvr�r�rrorrr�r�rrrrr	rr2rr3r
r!r#r*r-�intr0r2r6r�rLrJr�r��s���������HM�S�S�S�0�S�@D�S�	
�S�S�S�S�"����D�e�C��#��$6�7�D�D�AQ�<R�D�D�D�D�A�x��c�3�h��'@�A�T�A�A�A�A�*�C��$4������C��$4�������0��
�-�	 �����X����4��
�*�	�����X���,
����S�(�3�-�'�(��
�%�
�z�1�2�	3�
����X��,
�8�8��S�(�3�-�'�(�8�
�%�
�z�1�2�	3�
8�8�8�8��,
�#������S�(�3�-�'�(���s�m��
�}�j�(�	)�����@��0��
�-�	 �����X����4��
�*�	�����X���,
����S�(�3�-�'�(��
�%�
�z�1�2�	3�
����X��,
�E�E��S�(�3�-�'�(�E�
�%�
�z�1�2�	3�
E�E�E�E�8�h�}�&=�8�8�8�8�'�	������}�j�0�1�2���}�j�0�1�2�	4�
�'�'�'�'�05�t�C�y�5�5�5�5�

�

�C�

�c�

�s�

�SW�

�

�

�

������rLr��LineCompc��t��S)zeA :class: `LineComp` instance for checking that an input linearly
    contains a sequence of strings.)r9r�rLrJ�linecompr;�s���:�:�rL�LineMatcher�r�c��tS)z�A reference to the :class: `LineMatcher`.

    This is instantiable with a list of lines (without their trailing newlines).
    This is useful for testing large texts, such as the output of commands.
    )r<r�s rJ�LineMatcher_fixturer?�s
���rL�tmp_path_factory�monkeypatch�Pytesterc�(�t|||d���S)a
    Facilities to write tests/configuration files, execute pytest in isolation, and match
    against expected output, perfect for black-box testing of pytest plugins.

    It attempts to isolate the test run from external factors as much as possible, modifying
    the current working directory to ``path`` and environment variables during initialization.

    It is particularly useful for testing plugins. It is similar to the :fixture:`tmp_path`
    fixture but provides methods which aid in testing pytest itself.
    Tr�)rB)r�r@rAs   rJ�pytesterrD�s���G�-�{�d�K�K�K�KrLr�c#�K�t��}t��}dV�|���|���dSr�)�SysPathsSnapshot�SysModulesSnapshot�restore)�	snappaths�snapmodss  rJ�
_sys_snapshotrK�sO���� �"�"�I�!�#�#�H�	�E�E�E�������
�������rLc#�ZK�ddlm}|��}|V�|���dS)Nr)�
get_config)�_pytest.configrM�_ensure_unconfigure)rMrMs  rJ�_config_for_testrP�sD����)�)�)�)�)�)�
�Z�\�\�F�
�L�L�L�
��� � � � � rLz
\d+\.\d\dsz(\d+) (\w+)c��eZdZdZdeeefdeedeede	ddf
d�Z
defd	�Zdeeeffd
�Z
edeeeffd���Z								dd
ededededededeedeeddfd�ZdS)�	RunResultz?The result of running a command from :class:`~pytest.Pytester`.r��outlines�errlines�durationr:Nc���	t|��|_n#t$r
||_YnwxYw||_	||_	t|��|_	t|��|_	||_dSr�)	r r�rrSrTr<r[r\rU)rzr�rSrTrUs     rJr�zRunResult.__init__s���	�-5�c�]�]�D�H�#���	�	�	��D�H�H�H�	���� ��
�1� ��
�1�!�(�+�+���	�
"�(�+�+���5� ��
�"�"s��+�+c��d|jt|jj��t|jj��|jfzS)NzK<RunResult ret=%s len(stdout.lines)=%d len(stderr.lines)=%d duration=%.2fs>)r�r�r[rr\rUr�s rJr�zRunResult.__repr__)s:��Y��x��T�[�.�/�/��T�[�5F�1G�1G���W�
X�	
rLc�6�|�|j��S)aUReturn a dictionary of outcome noun -> count from parsing the terminal
        output that the test process produced.

        The returned nouns will always be in plural form::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        )�parse_summary_nounsrSr�s rJ�
parseoutcomeszRunResult.parseoutcomes/s���'�'��
�6�6�6rLc���t|��D]D}t�|��r(t�|��}d�|D��}n�Etd���ddd���fd�|���D��S)aExtract the nouns from a pytest terminal summary line.

        It always returns the plural noun for consistency::

            ======= 1 failed, 1 passed, 1 warning, 1 error in 0.13s ====

        Will return ``{"failed": 1, "passed": 1, "warnings": 1, "errors": 1}``.
        c�4�i|]\}}|t|����Sr�)r8)r��count�nouns   rJ�
<dictcomp>z1RunResult.parse_summary_nouns.<locals>.<dictcomp>Hs$��F�F�F�M�U�D�t�S��Z�Z�F�F�FrLz(Pytest terminal summary report not found�warnings�errors)�warningr�c�D��i|]\}}��||��|��Sr�)�get)r��k�v�	to_plurals   �rJr_z1RunResult.parse_summary_nouns.<locals>.<dictcomp>Qs-���?�?�?�4�1�a�	�
�
�a��#�#�Q�?�?�?rL)�reversed�rex_session_duration�search�rex_outcome�findallr�items)�clsrr`r4r�rgs     @rJrYzRunResult.parse_summary_nouns;s�����U�O�O�	I�	I�D�#�*�*�4�0�0�
�&�.�.�t�4�4��F�F�X�F�F�F����
�
�G�H�H�H�"��
�
�	�@�?�?�?�3�9�9�;�;�?�?�?�?rLrrr,r(ra�xpassed�xfailedr`�
deselectedc	�f�d}	ddlm}
|���}|
|||||||||��	�	dS)z�
        Assert that the specified outcomes appear with the respective
        numbers (0 means it didn't occur) in the text output from a test run.

        ``warnings`` and ``deselected`` are only checked if not None.
        Tr)�assert_outcomes)rr,r(rarorpr`rqN)r3rsrZ)rzrr,r(rarorpr`rqr�rsr4s            rJrszRunResult.assert_outcomesSsk��"!��?�?�?�?�?�?��%�%�'�'������������!�
	
�
	
�
	
�
	
�
	
�
	
rL)rrrrrrNN)r�r�r�r�rr8r rro�floatr�r�rrZ�classmethodrYr
rsr�rLrJrRrR
st������I�I�#�
�3��=�
!�#��s�)�#��s�)�	#�
�#�
�
#�#�#�#�6
�#�
�
�
�
�
7�t�C��H�~�
7�
7�
7�
7��@�4��S��>�@�@�@��[�@�2������"&�$(�
�
��
��
��	
�
�
��

��
��3�-�
��S�M�
�
�
�
�
�
�
�
rLrRc��eZdZdd�Zdd�ZdS)�CwdSnapshotr:Nc�6�tj��|_dSr�)rp�getcwd�_CwdSnapshot__savedr�s rJr�zCwdSnapshot.__init__vs���y�{�{����rLc�8�tj|j��dSr�)rp�chdirrzr�s rJrHzCwdSnapshot.restoreys��
��������rLr7�r�r�r�r�rHr�rLrJrwrwus<������#�#�#�#������rLrwc�F�eZdZddeeegefddfd�Zdd�ZdS)rGN�preserver:c�P�||_ttj��|_dSr�)�_SysModulesSnapshot__preserve�dictr��modules�_SysModulesSnapshot__saved)rzrs  rJr�zSysModulesSnapshot.__init__~s��"����C�K�(�(����rLc����jrB�j��fd�tj���D����tj���tj��j��dS)Nc3�P�K�|] \}}��|���||fV��!dSr�)r�)r�re�mrzs   �rJr�z-SysModulesSnapshot.restore.<locals>.<genexpr>�sP����� � ��1�a�$�/�/�!�:L�:L� ��A�� � � � � � rL)r�r�r�r�r�rmr6r�s`rJrHzSysModulesSnapshot.restore�s�����?�	��L��� � � � �#&�;�#4�#4�#6�#6� � � �
�
�
�	�����������4�<�(�(�(�(�(rLr�r7)	r�r�r�r
rrorvr�rHr�rLrJrGrG}s_������)�)��(�C�5�$�;�*?�!@�)�D�)�)�)�)�)�)�)�)�)�)rLrGc��eZdZdd�Zdd�ZdS)rFr:Nc�t�ttj��ttj��f|_dSr�)r�r��path�	meta_path�_SysPathsSnapshot__savedr�s rJr�zSysPathsSnapshot.__init__�s$���C�H�~�~�t�C�M�':�':�:����rLc�V�|j\tjdd�<tjdd�<dSr�)r�r�r�r�r�s rJrHzSysPathsSnapshot.restore�s)��(,��%�������S�]�1�1�1�%�%�%rLr7r}r�rLrJrFrF�s<������;�;�;�;�5�5�5�5�5�5rLrFc
�"�eZdZUdZdZeZded<Gd�de��Z	dd�de
d	ed
ede
dd
f
d�Zedefd���Zdefd�Zd`d�Zdefd�Zdedefd�Zd`d�Z	dadedeeeefdeeefdedef
d�Z dedededefd�Z!dedefd �Z"dedefd!�Z#dede$fd"�Z%dedefd#�Z&defd$�Z'defd%�Z(	dbd&e)eed'fdd
fd(�Z*d)eed'fdefd*�Z+d)eed'fdefd+�Z,dbd)e)edefd,�Z-d-e.d.eed'fdee/e0ffd/�Z1d&eed'fdee/e0ffd0�Z2d1eee0e/fde3e0fd2�Z4dedefd3�Z5dedefd4�Z6de7e3e0effd5�Z8d6dd7�deed'fd8e
defd9�Z9deed'fdede:fd:�Z;deed'fdede:fd;�Z<deeed'fde3eed'ffd<�Z=deed'fde.fd=�Z>deed'fde.fd>�Z?	dcdeed'fd@ede0fdA�Z@deed'fde3e0fdB�ZA	ddddC�deed'fdDe
fdE�ZBdFe/d)ede)ee0e/ffdG�ZCeDjEeDjEefdHeeed'fdIeeFeGfdJeeFeGfdKeeHeeIeeFffdL�ZJd
edM�dHeed'fdNe)eKdKeeHeeIeeFfde:fdO�ZLdP�ZMde7edQffdR�ZNdSd'de:fdT�ZOdUede:fdV�ZPd
dW�deed'fdNe)eKde:fdX�ZQ	dedZed[eKdd\fd]�ZRded^ed[eKdd\fd_�ZSd
S)frBan
    Facilities to write tests/configuration files, execute pytest in isolation, and match
    against expected output, perfect for black-box testing of pytest plugins.

    It attempts to isolate the test run from external factors as much as possible, modifying
    the current working directory to :attr:`path` and environment variables during initialization.
    Fr6�CLOSE_STDINc��eZdZdS)�Pytester.TimeoutExpiredN�r�r�r�r�rLrJ�TimeoutExpiredr��s�������rLr�r�r�r@rAr�r:Nc��t|��||_t��|_|jr
|jj}n|jj}||_|�	|d���|_
g|_t��|_
t��|_|���|_|���|j�|j��|jj�d��|_|�	d|��d���|_|x|_}|�dt7|j����|�dd���|�d	d���t7|j��}|�d
|��|�d|��|�dd
��dS)NT)�numberedrBztmp-�PYTEST_DEBUG_TEMPROOT�TOX_ENV_DIRF)�raising�PYTEST_ADDOPTS�HOME�USERPROFILE�	PY_COLORS�0)r%r�r�_mod_collections�functionr��noder�r��mktemp�_path�pluginsrw�
_cwd_snapshotrF�_sys_path_snapshot�$_Pytester__take_sys_modules_snapshot�_sys_modules_snapshotr|r��	_finalizerM�	getoption�_method�
_test_tmproot�_monkeypatch�setenvro�delenvr�)rzr�r@rAr�r��mp�tmphomes        rJr�zPytester.__init__�s���	�y�!�!�!���
�
���	
����	%��(�1�D�D��<�$�D���
�+�2�2�4�$�2�G�G��
�
9;���(�]�]���"2�"4�"4���%)�%E�%E�%G�%G��"��
�
�����
�"�"�4�>�2�2�2��}�+�5�5�m�D�D���-�4�4�]�D�]�]�T�4�R�R���!,�,���B�
�	�	�)�3�t�/A�+B�+B�C�C�C�
�	�	�-��	�/�/�/�
�	�	�"�E�	�2�2�2��d�i�.�.��
�	�	�&�'�"�"�"�
�	�	�-��)�)�)�
�	�	�+�s�#�#�#�#�#rLc��|jS)zBTemporary directory path used to create files/run tests from, etc.)r�r�s rJr�z
Pytester.path�s���z�rLc��d|j�d�S)Nz
<Pytester �>)r�r�s rJr�zPytester.__repr__�s��*�D�I�*�*�*�*rLc��|j���|j���|j���dS)a
        Clean up global state artifacts.

        Some methods modify the global interpreter state and this tries to
        clean this up. It does not remove the temporary directory however so
        it can be looked at after the test run has finished.
        N)r�rHr�r�r�s rJr�zPytester._finalize�sI��	
�"�*�*�,�,�,���'�'�)�)�)���"�"�$�$�$�$�$rLc�(�d�}t|���S)Nc�,�|�d��S)N)�zope�readlinergr=s rJ�preserve_modulez=Pytester.__take_sys_modules_snapshot.<locals>.preserve_module�s���?�?�#7�8�8�8rL)r)rG)rzr�s  rJ�__take_sys_modules_snapshotz$Pytester.__take_sys_modules_snapshot�s$��	9�	9�	9�"�?�;�;�;�;rLrSc�t�t|d���x|_}|j�|j��|S)zFCreate a new :class:`HookRecorder` for a :class:`PytestPluginManager`.Tr�)r��reprecr�r�r�)rzrSr�s   rJ�make_hook_recorderzPytester.make_hook_recorder�s:��(4�]�d�(S�(S�(S�S�
��v��
�"�"�6�#:�;�;�;��
rLc�8�tj|j��dS)zaCd into the temporary directory.

        This is done automatically upon instantiation.
        N)rpr|r�r�s rJr|zPytester.chdir�s��
	��������rL�utf-8�extr�filesr_c�����t|�����}|r*|�d��std|�d|�����dtt
tfdtf�fd��|r@d��fd�|D����}|j	}|�
d	||f��d}|D]�\}}	|j�|���
|��}
|
j�d
d
���t!|	��}d��fd�|jD����}|
�|�����
��|�|
}��|�J�|S)N�.z1pytester.makefile expects a file extension, try .z instead of �sr:c�v��t|t��r|����nt|��Sr�)r��bytes�decodero)r�r_s �rJ�to_textz#Pytester._makefile.<locals>.to_texts/���)3�A�u�)=�)=�I�1�8�8�H�%�%�%�3�q�6�6�IrLrjc3�.�K�|]}�|��V��dSr�r�)r�r�r�s  �rJr�z%Pytester._makefile.<locals>.<genexpr>s+�����9�9�a�w�w�q�z�z�9�9�9�9�9�9rLrT)�parents�exist_okc3�.�K�|]}�|��V��dSr�r�)r�r`r�s  �rJr�z%Pytester._makefile.<locals>.<genexpr>s+�����G�G��w�w�t�}�}�G�G�G�G�G�GrL�r_)r�rmrhrrrr�ror�r��insertr��joinpath�with_suffix�parent�mkdirrr�
write_text�strip)
rzr�rr�r_rm�source�basenamer��value�p�source_r�s
    `       @rJ�	_makefilezPytester._makefile�s������U�[�[�]�]�#�#���	�s�~�~�c�*�*�	��Z�C�Z�Z�UX�Z�Z���
�	J�u�S�%�Z�(�	J�S�	J�	J�	J�	J�	J�	J��	0��Y�Y�9�9�9�9�5�9�9�9�9�9�F��z�H��L�L��X�v�.�/�/�/���$�	�	�O�H�e��	�"�"�8�,�,�8�8��=�=�A�
�H�N�N�4�$�N�7�7�7��U�m�m�G��Y�Y�G�G�G�G���G�G�G�G�G�F�
�L�L������(�L�;�;�;��{���������
rL�argsr�c�0�|�|||��S)a�Create new text file(s) in the test directory.

        :param ext:
            The extension the file(s) should use, including the dot, e.g. `.py`.
        :param args:
            All args are treated as strings and joined using newlines.
            The result is written as contents to the file.  The name of the
            file is based on the test function requesting this fixture.
        :param kwargs:
            Each keyword is the name of a file, while the value of it will
            be written as contents of the file.
        :returns:
            The first created file.

        Examples:

        .. code-block:: python

            pytester.makefile(".txt", "line1", "line2")

            pytester.makefile(".ini", pytest="[pytest]\naddopts=-rs\n")

        To create binary files, use :meth:`pathlib.Path.write_bytes` directly:

        .. code-block:: python

            filename = pytester.path.joinpath("foo.bin")
            filename.write_bytes(b"...")
        �r�)rzr�r�r�s    rJ�makefilezPytester.makefile s��<�~�~�c�4��0�0�0rLr�c�.�|�|���S)zoWrite a contest.py file.

        :param source: The contents.
        :returns: The conftest.py file.
        )�conftest)�
makepyfile�rzr�s  rJ�makeconftestzPytester.makeconftest@s�������/�/�/rLc�0�|�d|���S)zhWrite a tox.ini file.

        :param source: The contents.
        :returns: The tox.ini file.
        z.ini)�tox�r�r�s  rJ�makeinizPytester.makeiniHs���}�}�V��}�0�0�0rLc�p�|�|��}tt|����dS)z7Return the pytest section from the tox.ini config file.�pytest)r�rro)rzr�r�s   rJ�	getinicfgzPytester.getinicfgPs,���L�L�� � ����Q��� � ��*�*rLc�0�|�d|���S)z�Write a pyproject.toml file.

        :param source: The contents.
        :returns: The pyproject.ini file.

        .. versionadded:: 6.0
        z.toml)�	pyprojectr�r�s  rJ�makepyprojecttomlzPytester.makepyprojecttomlUs���}�}�W��}�7�7�7rLc�0�|�d||��S)aSShortcut for .makefile() with a .py extension.

        Defaults to the test name with a '.py' extension, e.g test_foobar.py, overwriting
        existing files.

        Examples:

        .. code-block:: python

            def test_something(pytester):
                # Initial file is created test_something.py.
                pytester.makepyfile("foobar")
                # To create multiple files, pass kwargs accordingly.
                pytester.makepyfile(custom="foobar")
                # At this point, both 'test_something.py' & 'custom.py' exist in the test directory.

        �.pyr��rzr�r�s   rJr�zPytester.makepyfile_s��$�~�~�e�T�6�2�2�2rLc�0�|�d||��S)a[Shortcut for .makefile() with a .txt extension.

        Defaults to the test name with a '.txt' extension, e.g test_foobar.txt, overwriting
        existing files.

        Examples:

        .. code-block:: python

            def test_something(pytester):
                # Initial file is created test_something.txt.
                pytester.maketxtfile("foobar")
                # To create multiple files, pass kwargs accordingly.
                pytester.maketxtfile(custom="foobar")
                # At this point, both 'test_something.txt' & 'custom.txt' exist in the test directory.

        z.txtr�r�s   rJ�maketxtfilezPytester.maketxtfiless��$�~�~�f�d�F�3�3�3rLr�zos.PathLike[str]c�f�|�|j}|j�t|����dS)z�Prepend a directory to sys.path, defaults to :attr:`path`.

        This is undone automatically when this object dies at the end of each
        test.

        :param path:
            The path.
        N)r�r��syspath_prependro)rzr�s  rJ�
syspathinsertzPytester.syspathinsert�s3���<��9�D���)�)�#�d�)�)�4�4�4�4�4rLr�c�B�|j|z}|���|S)z�Create a new (sub)directory.

        :param name:
            The name of the directory, relative to the pytester path.
        :returns:
            The created directory.
        )r�r��rzr�r�s   rJr�zPytester.mkdir�s"��
�I����	���	�	�	��rLc��|j|z}|���|�d�����|S)z�Create a new python package.

        This creates a (sub)directory with an empty ``__init__.py`` file so it
        gets recognised as a Python package.
        �__init__.py)r�r�r��touchr�s   rJ�mkpydirzPytester.mkpydir�s@��
�I����	���	�	�	�	�
�
�=�!�!�'�'�)�)�)��rLc�@�|jj�d��}|�td���|jjj|z}|jj�d��D]}|jsJ�|j|j�}�|�V|j	}||z}||dzz}|�
��r|}n@|���r|}n)t|�d|�����|�|��}|�
��rC|�d�����st||j��|jS|���r6|j�|j��}	t!j||	��|	Std|�d	����)
z�Copy file from project's directory into the testdir.

        :param name:
            The name of the file to copy.
        :return:
            Path to the copied directory (inside ``self.path``).
        rGNz2pytester_example_dir is unset, can't copy examples�pytester_example_pathr�z( can't be found as module or package in r�z	example "z%" is not found as a file or directory)r�rM�getinir�rootpathr��iter_markersr�r�r��is_dir�is_file�LookupErrorr0r�r��shutilr�)
rzr��example_dir_�example_dir�
extra_element�	func_name�	maybe_dir�
maybe_file�example_path�results
          rJ�copy_examplezPytester.copy_example�s����}�+�2�2�3I�J�J�����Q�R�R�R� �M�0�9�L�H��!�]�/�<�<�=T�U�U�	D�	D�M� �%�%�%�%�.�+�.�
�0B�C�K�K��<��
�I�#�i�/�I�$�	�E�(9�:�J����!�!�
�(����#�#�%�%�
�)���!� �W�W�+�W�W����'�/�/��5�5�L���� � �
	��)>�)>�}�)M�)M�)U�)U�)W�)W�
	��\�4�9�-�-�-��9��
�
!�
!�
#�
#�	��Y�'�'��(9�:�:�F��K��f�-�-�-��M��O�L�O�O�O���
rLrM�argc��tj|��}dt|��vsJ�ttj�|����}|j�|���|�	t|��gd���d}|j�
|tj���|S)aGet the collection node of a file.

        :param config:
           A pytest config.
           See :py:meth:`parseconfig` and :py:meth:`parseconfigure` for creating it.
        :param arg:
            Path to the file.
        :returns:
            The node.
        r��sessionF��genitemsr�r�
exitstatus)
r(�from_configrorrpr��abspathr��pytest_sessionstart�perform_collect�pytest_sessionfinishr �OK)rzrMrrr��ress      rJ�getnodezPytester.getnode�s����%�f�-�-���3�s�8�8�#�#�#�#�������%�%�&�&����'�'��'�8�8�8��%�%�s�1�v�v�h��%�?�?��B����(�(��X�[�(�Q�Q�Q��
rLc�^�t|��}|�|��}tj|��}t	|j|��}|j�|���|�|gd���d}|j�	|tj���|S)aReturn the collection node of a file.

        This is like :py:meth:`getnode` but uses :py:meth:`parseconfigure` to
        create the (configured) pytest Config instance.

        :param path:
            Path to the file.
        :returns:
            The node.
        rFrrr)r�parseconfigurer(rr/r�r�rrrr r)rzr�rMrr�rs      rJ�getpathnodezPytester.getpathnode�s����D�z�z���$�$�T�*�*���%�f�-�-�����d�+�+����'�'��'�8�8�8��%�%�q�c�E�%�:�:�1�=����(�(��X�[�(�Q�Q�Q��
rL�colitemsc�~�|dj}g}|D]*}|�|�|�����+|S)aGenerate all test items from a collection node.

        This recurses into the collection node and returns a list of all the
        test items contained within.

        :param colitems:
            The collection nodes.
        :returns:
            The collected items.
        r)rrr)rzr!rr�colitems     rJrzPytester.genitemssL���1�+�%�����	5�	5�G��M�M�'�*�*�7�3�3�4�4�4�4��
rLc��|�|��}|jj}|���}||��S)a'Run the "test_func" Item.

        The calling test instance (class containing the test method) must
        provide a ``.getrunner()`` method which should return a runner which
        can run the test protocol for a single item, e.g.
        :py:func:`_pytest.runner.runtestprotocol`.
        )�getitemr��instance�	getrunner)rzr�r��testclassinstance�runners     rJ�runitemzPytester.runitems?���|�|�F�#�#�� �M�2��"�,�,�.�.���v�d�|�|�rLc�f�|�|��}t|��|gz}|j|�S)agRun a test module in process using ``pytest.main()``.

        This run writes "source" into a temporary file and runs
        ``pytest.main()`` on it, returning a :py:class:`HookRecorder` instance
        for the result.

        :param source: The source code of the test module.
        :param cmdlineargs: Any extra command line arguments to use.
        )r�r��
inline_run)rzr��cmdlineargsr�r�s     rJ�inline_runsourcezPytester.inline_runsource&s8��
�O�O�F�#�#���k�"�"�a�S�(���t���'�'rLc�d�|jdg|�R�}d�|�d��D��}||fS)a!Run ``pytest.main(['--collectonly'])`` in-process.

        Runs the :py:func:`pytest.main` function to run all of pytest inside
        the test process itself like :py:meth:`inline_run`, but returns a
        tuple of the collected items and a :py:class:`HookRecorder` instance.
        z--collect-onlyc��g|]	}|j��
Sr�)r�r�s  rJr�z,Pytester.inline_genitems.<locals>.<listcomp><s��F�F�F�A���F�F�FrL�pytest_itemcollected)r,r�)rzr��recrms    rJ�inline_genitemszPytester.inline_genitems4sH���d�o�.�6��6�6�6��F�F����.D�!E�!E�F�F�F���c�z�rLr�)r��no_reraise_ctrlcr4c����
�tj��t|��}g}	|�����j��|�t
��j��g�
G�
�fd�d��}|�|����td�|D��|���}t�
��dkr�
�	��}n
Gd�d��}||_
|tjkrB|s@|�
d��}|r)|d	jjt krt!���||D]}	|	���
S#|D]}	|	���
wxYw)
a�Run ``pytest.main()`` in-process, returning a HookRecorder.

        Runs the :py:func:`pytest.main` function to run all of pytest inside
        the test process itself.  This means it can return a
        :py:class:`HookRecorder` instance which gives more detailed results
        from that run than can be done by matching stdout/stderr from
        :py:meth:`runpytest`.

        :param args:
            Command line arguments to pass to :py:func:`pytest.main`.
        :param plugins:
            Extra plugin instances the ``pytest.main()`` instance should use.
        :param no_reraise_ctrlc:
            Typically we reraise keyboard interrupts from the child run. If
            True, the KeyboardInterrupt exception is captured.
        c�&��eZdZdeddf��fd�ZdS)�$Pytester.inline_run.<locals>.CollectrMr:Nc�b������|j����dSr�)ryr�rS)r�rMr2rzs  ��rJrWz5Pytester.inline_run.<locals>.Collect.pytest_configurems,����J�J�t�6�6�v�7K�L�L�M�M�M�M�MrL)r�r�r�rrW)r2rzs��rJ�Collectr7lsQ�������N��N�4�N�N�N�N�N�N�N�N�NrLr9c�,�g|]}t|����Sr�r�r�s  rJr�z'Pytester.inline_run.<locals>.<listcomp>qs��-�-�-�1��A���-�-�-rL)r�rlc��eZdZdS)�#Pytester.inline_run.<locals>.reprecNr�r�rLrJr�r<vs�������DrLr��pytest_keyboard_interrupt���)�	importlib�invalidate_cachesr�ryr�rHrFr"r�r�r�r �INTERRUPTEDr��excinfo�type�KeyboardInterrupt)rzr�r4r��
finalizersr9r�r�r��	finalizerr2s`         @rJr,zPytester.inline_run?s�����2	�#�%�%�%��w�-�-���
�(	�

���d�>�>�@�@�H�I�I�I����.�0�0�8�9�9�9��C�
N�
N�
N�
N�
N�
N�
N�
N�
N�
N�
N�
�N�N�7�7�9�9�%�%�%��-�-��-�-�-�w�?�?�?�C��3�x�x�1�}�}�����������������F�J��h�*�*�*�3C�*����(C�D�D���.�U�2�Y�.�3�7H�H�H�+�-�-�-��'�
�
�	��	�����
��Z�
�
�	��	�����
���s�D+E#�#E4c�h�|�dd��}|r|���tj��}t	d��}|���		|j|i|��}n�#t$rP}|jd}	t|jd��}n#t$rYnwxYwGd�d��}Yd}~n3d}~wt$r#tj
��Gd�d��}YnwxYw|���\}	}
|���t j�|	��t j�|
��nn#|���\}	}
|���t j�|	��t j�|
��wxYw|j�J�t+|j|	���|
���tj��|z
��}||_|S)	ztReturn result of running pytest in-process, providing a similar
        interface to what self.runpytest() provides.r�Fr�rc��eZdZeZdS)�,Pytester.runpytest_inprocess.<locals>.reprecN)r�r�r�r�r�rLrJr�rI�s�������C�C�CrLr�Nc�$�eZdZed��ZdS)rI�N)r�r�r�r r�r�rLrJr�z,Pytester.runpytest_inprocess.<locals>.reprec�s������"�(�1�+�+�C�C�CrL)r�r�r�timer�start_capturingr,�
SystemExitr�r r�	Exception�	traceback�	print_exc�
readouterr�stop_capturingr�r[�writer\r�rR�
splitlinesr�)rzr�r�r��now�capturer��er�r{�errrs            rJ�runpytest_inprocesszPytester.runpytest_inprocess�s���
�
�
�?�E�:�:�
��	!���� � � ��k�m�m��#�E�*�*�����!�!�!�	"�
&�(���$�9�&�9�9�����
�
�
��f�Q�i���"�1�6�!�9�-�-�C�C��!�����D�����������������������
&�
&�
&��#�%�%�%�&�&�&�&�&�&�&�&�&�&�
&�����)�)�+�+�H�C���"�"�$�$�$��J���S�!�!�!��J���S�!�!�!�!���)�)�+�+�H�C���"�"�$�$�$��J���S�!�!�!��J���S�!�!�!�!�����z�%�%�%���J����(�(�#�.�.�*:�*:�F�K�M�M�C�<O�
�
����
��
sa�%
A3�2E%�3
C8�=
C�B&�%C�&
B3�0C�2B3�3C�E%�-C8�5E%�7C8�8E%�%A+Gc��|�|��}|jdkr
|j|i|��S|jdkr
|j|i|��St	d|j�����)z�Run pytest inline or in a subprocess, depending on the command line
        option "--runpytest" and return a :py:class:`~pytest.RunResult`.rCrEzUnrecognized runpytest option: )�_ensure_basetempr�rZ�runpytest_subprocess�RuntimeError)rzr�r��new_argss    rJrDzPytester.runpytest�sz��
�(�(��.�.���<�;�&�&�+�4�+�X�@��@�@�@�
�\�\�
)�
)�,�4�,�h�A�&�A�A�A��K�T�\�K�K�L�L�LrLc���t|��}|D]&}t|���d��rn6�'|�d|jj�d��z��|S)Nz
--basetemp�
--basetemp=%s�basetemp)r�rorhryr�r�r�)rzr�r_r�s    rJr\zPytester._ensure_basetemp�sw����:�:���	U�	U�A��1�v�v� � ��.�.�
���
�
�O�O�O�d�i�.>�.G�.G�
�.S�.S�S�T�T�T��rLc���ddl}|�|��}d�|D��}|j�||j��}|j�|j��|S)a�Return a new pytest :class:`pytest.Config` instance from given
        commandline args.

        This invokes the pytest bootstrapping code in _pytest.config to create a
        new :py:class:`pytest.PytestPluginManager` and call the
        :hook:`pytest_cmdline_parse` hook to create a new :class:`pytest.Config`
        instance.

        If :attr:`plugins` has been populated they should be plugin modules
        to be registered with the plugin manager.
        rNc�,�g|]}t|����Sr�r�r�s  rJr�z(Pytester.parseconfig.<locals>.<listcomp>�s��-�-�-�q�C��F�F�-�-�-rL)rNr\rM�_prepareconfigr�r�r�rO)rzr�r�r_rMs     rJ�parseconfigzPytester.parseconfig�so��	�����(�(��.�.��-�-�H�-�-�-����.�.�x���F�F��	
�
�"�"�6�#=�>�>�>��
rLc�B�|j|�}|���|S)z�Return a new pytest configured Config instance.

        Returns a new :py:class:`pytest.Config` instance like
        :py:meth:`parseconfig`, but also calls the :hook:`pytest_configure`
        hook.
        )rf�
_do_configure)rzr�rMs   rJrzPytester.parseconfigure�s*��"��!�4�(���������
rL�	test_func�funcnamec��|�|��}|D]}|j|kr|cS�Jd�|||�����)a�Return the test item for a test function.

        Writes the source to a python file and runs pytest's collection on
        the resulting module, returning the test item for the requested
        function name.

        :param source:
            The module source.
        :param funcname:
            The name of the test function for which to return a test item.
        :returns:
            The test item.
        rz+{!r} item not found in module:
{}
items: {})�getitemsr�r)rzr�rjrmr�s     rJr%zPytester.getitem�sj�� �
�
�f�%�%���	�	�D��y�H�$�$�����%�	
�A�H�H��f�e�
�
�	
�	
�qrLc�X�|�|��}|�|g��S)z�Return all test items collected from the module.

        Writes the source to a Python file and runs pytest's collection on
        the resulting module, returning all test items contained within.
        )�getmodulecolr)rzr��modcols   rJrlzPytester.getitemss+���"�"�6�*�*���}�}�f�X�&�&�&rL)�withinitrpc�P�t|tj��r'|j�|��}|r
Jd���n#|jt
|��i}|jdi|��}|r|�d���|j|g|�R�x|_	}|�
||��S)a*Return the module collection node for ``source``.

        Writes ``source`` to a file using :py:meth:`makepyfile` and then
        runs the pytest collection on it, returning the collection node for the
        test module.

        :param source:
            The source code of the module to collect.

        :param configargs:
            Any extra arguments to pass to :py:meth:`parseconfigure`.

        :param withinit:
            Whether to also write an ``__init__.py`` file to the same
            directory to ensure it is a package.
        znot supported for paths�#)r�r�)r�rp�PathLiker�r�r�ror�rrMr)rzr��
configargsrpr��kwrMs       rJrnzPytester.getmodulecol
s���.�f�b�k�*�*�	)��9�%�%�f�-�-�D��:�:�!:�:�:�<�:��*�c�&�k�k�*�B�"�4�?�(�(�R�(�(�D��	*��O�O�S�O�)�)�)�2�t�2�4�E�*�E�E�E�E���f��|�|�F�D�)�)�)rLroc��||jvr)t|�����|j|<|j|D]}|j|kr|cS�dS)a.Return the collection node for name from the module collection.

        Searches a module collection node for a collection node matching the
        given name.

        :param modcol: A module collection node; see :py:meth:`getmodulecol`.
        :param name: The name of the node to return.
        N)r�r�r�r�)rzror�r#s    rJ�collect_by_namezPytester.collect_by_name/sh����.�.�.�,0����1A�1A�,B�,B�D�!�&�)��,�V�4�	�	�G��|�t�#�#�����$��trL�cmdargsr[r\�stdinc
�r�tj���}tj�tdtj��|�dd��g����|d<||d<||jurtj
|d<n*t|t��rtj
|d<n||d<tj
|f||d�|��}||jur#|j�J�|j���n8t|t��r#|j�J�|j�|��|S)z�Invoke :py:class:`subprocess.Popen`.

        Calls :py:class:`subprocess.Popen` making sure the current working
        directory is in ``PYTHONPATH``.

        You probably want to use :py:meth:`run` instead.
        N�
PYTHONPATHr�envry)r[r\)rp�environr��pathsepr��filterryrdr�rErrr�r��Popenry�closerT)rzrxr[r\ryrur|�popens        rJr�zPytester.popenAs0���j�o�o�����J�O�O��4�"�)�+�+�s�w�w�|�R�'@�'@�A�B�B�
�
��L����5�	��D�$�$�$�$�/�B�w�K�K�
��u�
%�
%�	 �$�/�B�w�K�K��B�w�K�� ��M���M�M�"�M�M���D�$�$�$��;�*�*�*��K�������
��u�
%�
%�	%��;�*�*�*��K���e�$�$�$��rL)�timeoutryr�c
������d}td��D������j�d��}�j�d��}tdg��R�tdt	j����|�dd�	��5}|�dd�	��5}tj��}	��	�|||tjd
k�����j��j�
��d����fd�}
������}n6	�����}n#tj$r
|
��YnwxYwddd��n#1swxYwYddd��n#1swxYwY|�d�	��5}|�d�	��5}|������}|������}
ddd��n#1swxYwYddd��n#1swxYwY��|tj����|
tj��t-jt0��5t3|��}ddd��n#1swxYwYt5|||
tj��|	z
��S)a�Run a command with arguments.

        Run a process using :py:class:`subprocess.Popen` saving the stdout and
        stderr.

        :param cmdargs:
            The sequence of arguments to pass to :py:class:`subprocess.Popen`,
            with path-like objects being converted to :py:class:`str`
            automatically.
        :param timeout:
            The period in seconds after which to timeout and raise
            :py:class:`Pytester.TimeoutExpired`.
        :param stdin:
            Optional standard input.

            - If it is :py:attr:`CLOSE_STDIN` (Default), then this method calls
              :py:class:`subprocess.Popen` with ``stdin=subprocess.PIPE``, and
              the standard input is closed immediately after the new command is
              started.

            - If it is of type :py:class:`bytes`, these bytes are sent to the
              standard input of the command.

            - Otherwise, it is passed through to :py:class:`subprocess.Popen`.
              For further information in this case, consult the document of the
              ``stdin`` parameter in :py:class:`subprocess.Popen`.
        :returns:
            The result.
        Tc3�>K�|]}tj|��V��dSr�)rp�fspath)r�rs  rJr�zPytester.run.<locals>.<genexpr>�s*����:�:�3��	�#���:�:�:�:�:�:rLr[r\zrunning:z     in:�w�utf8r��win32)ryr[r\�	close_fdsNr:c���d}d������}����������|���)NTz3{seconds} second timeout expired running: {command})�seconds�command)r�kill�waitr�)r��timeout_messagerxr�rzr�s  ����rJ�handle_timeoutz$Pytester.run.<locals>.handle_timeout�sT���$(�!�!�!'�����!I�!I� �
�
�
�����
�
�����)�)�/�:�:�:rLr7)�tupler�r�r�rrf�openrrLr�r��platformryr�r�rEr��readrU�_dump_linesr[r\�
contextlib�suppressrr rR)rzr�ryrxr��p1�p2�f1�f2rVr�r�r{rYr�s`` `          @rJrnzPytester.rungs�������F!���:�:�'�:�:�:�:�:��
�Y�
�
��
)�
)��
�Y�
�
��
)�
)��
�j�#�7�#�#�#�#�
�j�$�(�*�*�%�%�%�
�W�W�S�6�W�
*�
*�	%�b�"�'�'�#��'�2O�2O�	%�SU��+�-�-�C��J�J������<�7�2����E��{�&���!�!�#�#�#�

;�

;�

;�

;�

;�

;�

;�

;�

;����j�j�l�l���%��*�*�W�-�-�C�C��!�0�%�%�%�"�N�$�$�$�$�$�%����;	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�@�W�W�f�W�
%�
%�	)��R�W�W�f�W�-E�-E�	)���'�'�)�)�&�&�(�(�C��'�'�)�)�&�&�(�(�C�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)�	)����	)�	)�	)�	)�	
����c�j�)�)�)�����c�j�)�)�)�
�
 ��
,�
,�	 �	 ��3�-�-�C�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ���c�3���
�
��(;�<�<�<s��F�1A<E/�.E�E/�E �E/�E � E/�#F�/E3	�3F�6E3	�7F�F
�
F
�'H.�>A
H�H.�H	�H.�H	�H.�.H2�5H2�J.�.J2�5J2c�|�	|D]}t||����dS#t$rtd|�d���YdSwxYw)N)�filezcouldn't print to z because of encoding)r��UnicodeEncodeError)rzr�fpr`s    rJr�zPytester._dump_lines�sy��	A��
%�
%���d��$�$�$�$�$�
%�
%��!�	A�	A�	A��?�r�?�?�?�@�@�@�@�@�@�	A���s��;�;.c��tjdfS)Nz-mpytest)r��
executabler�s rJ�_getpytestargszPytester._getpytestargs�s���~�z�)�)rL�scriptc�B�|�tj|��S)z8Run a python script using sys.executable as interpreter.�rnr�r�)rzr�s  rJ�	runpythonzPytester.runpython�s���x�x����/�/�/rLr�c�D�|�tjd|��S)zRun ``python -c "command"``.z-cr�)rzr�s  rJ�runpython_czPytester.runpython_c�s���x�x����g�6�6�6rL)r�c���d}t|jdd���}d|zf|z}d�|jD��}|r
d|df|z}|���|z}|j|d	|i�S)
a�Run pytest as a subprocess with given arguments.

        Any plugins added to the :py:attr:`plugins` list will be added using the
        ``-p`` command line option.  Additionally ``--basetemp`` is used to put
        any temporary files and directories in a numbered directory prefixed
        with "runpytest-" to not conflict with the normal numbered pytest
        location for temporary files and directories.

        :param args:
            The sequence of arguments to pass to the pytest subprocess.
        :param timeout:
            The period in seconds after which to timeout and raise
            :py:class:`Pytester.TimeoutExpired`.
        :returns:
            The result.
        Tz
runpytest-�)�root�prefix�moderac�<�g|]}t|t���|��Sr�)r�ror�s  rJr�z1Pytester.runpytest_subprocess.<locals>.<listcomp>�s'��A�A�A��j��C�.@�.@�A�1�A�A�ArLrZrr�)r1r�r�r�rn)rzr�r�r�r�r�s      rJr]zPytester.runpytest_subprocess�s���&!���4�9�\��N�N�N���!�#�%��,��A�A�d�l�A�A�A���	-��'�!�*�%��,�D��"�"�$�$�t�+���t�x��/�w�/�/�/rL�$@�string�expect_timeoutz
pexpect.spawnc��|jdz}|�d���d�tt|�������}|�d|�d|��}|�||���S)z�Run pytest using pexpect.

        This makes sure to use the right pytest and sets up the temporary
        directory locations.

        The pexpect child is returned.
        ztemp-pexpectr�)r�� z --basetemp=)r�)r�r�r��mapror��spawn)rzr�r�rb�invoke�cmds      rJ�spawn_pytestzPytester.spawn_pytest�s|���9�~�-�����E��"�"�"����#�c�4�#6�#6�#8�#8�9�9�:�:���8�8�X�8�8��8�8���z�z�#�n�z�=�=�=rLr�c��tdd��}ttd��r$dtj��vrtd��t|d��std��|j�d���d	��}|j	|||�
��}|j
�|j��|S)zMRun a command using pexpect.

        The pexpect child is returned.
        �pexpectz3.0r��64zpypy-64 bit not supportedr�zpexpect.spawn not availablez	spawn.out�wb)�logfiler�)
r-r�r�r��machiner.r�r�r�r�r�r�r�)rzr�r�r�r��childs      rJr�zPytester.spawn�s���
�y�%�0�0���3�+�,�,�	.���9I�9K�9K�1K�1K��,�-�-�-��w��(�(�	0��.�/�/�/��)�$�$�[�1�1�6�6�t�<�<����
�c�7�N�K�K�K���
�"�"�7�=�1�1�1��rLr7)r�r�)ri)r�)r�)Tr�r�r�r��__test__rr��__annotations__rOr�r'r4r)rvr��propertyrr�ror�r�rGr�r#r�r�r|rrrr�rr�r�r�r�rr�r�r�r�r
r�r�r�r
rr*r+rr rrr*r.rr3r,rRrZrDr\rfrr%rlrnrwrErrr8rrr
r�rtrnr�r�r�r�r]r�r�r�rLrJrBrB�s	����������H�!�K��!�!�!�
�
�
�
�
��
�
�
� �
+$�+$�+$��+$�*�+$�!�	+$��
+$�
�+$�+$�+$�+$�Z��d�����X��+�#�+�+�+�+�
%�
%�
%�
%�
<�-?�
<�
<�
<�
<��0C����������� � � �
� ���c�5�j�)�*� ��C��H�~�	 �
� �
�
 � � � �D1�C�1��1�s�1�t�1�1�1�1�@0�3�0�4�0�0�0�0�1�c�1�d�1�1�1�1�+��+��+�+�+�+�
8��8��8�8�8�8�3�T�3�3�3�3�(4�d�4�4�4�4�*@D�5�5��U�3�(:�#:�;�<�5�	
�5�5�5�5� 
�%��%7� 7�8�
�T�
�
�
�
�	�E�#�'9�"9�:�	�t�	�	�	�	�+�+��#��+�$�+�+�+�+�Z���#(��.@�)@�#A��	�y�$��	�����*��#�1�1�2��	�y�$��	�����,��%��i��*@�!A��d�4�j�����"
�c�
�c�
�
�
�
�(�s�(�\�(�(�(�(�	��d�4�j�,�.F�(G�	�	�	�	��!&�	E�E�E��S�,�,�-�E��	E�

�E�E�E�E�N*��3� 2�2�3�*�?B�*�	�*�*�*�*�X
M��3� 2�2�3�
M�?B�
M�	�
M�
M�
M�
M�	��U�3�(:�#:�;�<�	�	
�e�C�+�+�,�	-�	�	�	�	���s�,>�'>�!?��F�����0	�E�#�/A�*A�$B�	�v�	�	�	�	�GR�
�
��C�!3�3�4�
�@C�
�	
�
�
�
�
�0'�u�S�*<�%<�=�'�$�t�*�'�'�'�'�� *�
� *� *� *��c�-�-�.� *�
� *� *� *� *�D���'*��	�%��i��(�	)�����*&0�_�%/�_�8C�$�$��%��%7� 7�8�9�$��c�6�k�"�$��c�6�k�"�	$�
�Z���3���4�5�$�$�$�$�R$(�8C�	T=�T=�T=���/�/�0�T=��%��T=��Z���3���4�5�	T=�

�T=�T=�T=�T=�lA�A�A�*��c�3�h��*�*�*�*�0� 2�0�y�0�0�0�0�7�3�7�9�7�7�7�7�
QU�0�0�0��3� 2�2�3�0�>F�u�o�0�	�0�0�0�0�:48�>�>��>�+0�>�	�>�>�>�>� ����e��������rLc�2�eZdZdd�Zdeeddfd�ZdS)r9r:Nc�,�t��|_dSr�)r�stringior�s rJr�zLineComp.__init__
s�� �
�
��
�D�DrLr�c��d}|j���}|j�d��|j�d��|�d��}t|���|��dS)z�Assert that ``lines2`` are contained (linearly) in :attr:`stringio`'s value.

        Lines are matched using :func:`LineMatcher.fnmatch_lines <pytest.LineMatcher.fnmatch_lines>`.
        TrrjN)r�rP�truncate�seekrwr<�
fnmatch_lines)rzr�r��valr�s     rJ�assert_contains_lineszLineComp.assert_contains_linessz��
!���m�$�$�&�&���
���q�!�!�!��
���1�������4�����F���)�)�&�1�1�1�1�1rLr7)r�r�r�r�rror�r�rLrJr9r9sR������E�E�E�E�
2�H�S�M�
2�d�
2�
2�
2�
2�
2�
2rLc��eZdZdZdeeddfd�Zdefd�Zdeee	ee
fde	efd�Zde	eddfd	�Zde	eddfd
�Z
de	edeeegefddfd�Zd
ede	efd�Zdd�Zedefd���Zdd�de	ededdfd�Zdd�de	ededdfd�Zdd�de	edeeegefdededdf
d�Zdeddfd�Zdeddfd�Zdedeeegefdeddfd�Zdeddfd�Zdefd�ZdS) r<z�Flexible matching of text.

    This is a convenience class to test large texts like the output of
    commands.

    The constructor takes a list of lines without their trailing newlines, i.e.
    ``text.splitlines()``.
    rr:Nc�"�||_g|_dSr�)r�_log_output)rzrs  rJr�zLineMatcher.__init__(s����
�&(����rLc�6�d�|j��S)zReturn the entire original text.

        .. versionadded:: 6.2
            You can use :meth:`str` in older versions.
        rj)r�rr�s rJ�__str__zLineMatcher.__str__,s���y�y���$�$�$rLr�c��t|t��rt|��}t|t��r|���j}|Sr�)r�rorr�r)rzr�s  rJ�	_getlineszLineMatcher._getlines4sF���f�c�"�"�	$��F�^�^�F��f�f�%�%�	*��\�\�^�^�)�F��
rLc�@�d}|�|t��dS)zTCheck lines exist in the output in any order (using :func:`python:fnmatch.fnmatch`).TN)�_match_lines_randomr�rzr�r�s   rJ�fnmatch_lines_randomz LineMatcher.fnmatch_lines_random;s$�� ��� � ���1�1�1�1�1rLc�8�d}|�|d���dS)zMCheck lines exist in the output in any order (using :func:`python:re.match`).Tc�F�ttj||����Sr��rv�re�match�r��pats  rJ�<lambda>z3LineMatcher.re_match_lines_random.<locals>.<lambda>Cs��4����d�@S�@S�;T�;T�rLN)r�r�s   rJ�re_match_lines_randomz!LineMatcher.re_match_lines_random@s(�� ��� � ��)T�)T�U�U�U�U�UrL�
match_funcc��d}|�|��}|D]r}|jD]9}||ks|||��r%|�dt|����n0�:d|z}|�|��|�|���sdS)NTz	matched: �line %r not found in output)r�r�_logr��_fail)rzr�r�r�r`r��msgs       rJr�zLineMatcher._match_lines_randomEs���!������'�'���	 �	 �D��Z�
 �
 ���1�9�9�
�
�1�d� 3� 3�9��I�I�k�4��:�:�6�6�6��E��4�d�:���	�	�#�����
�
�3�����	 �	 rL�fnlinec��t|j��D]/\}}||kst||��r|j|dzd�cS�0td|z���)zsReturn all lines following the given line in the text.

        The given line can contain glob wildcards.
        rlNr�)r�rrr)rzr�r�r`s    rJ�get_lines_afterzLineMatcher.get_lines_afterTsl��
!���,�,�	+�	+�G�A�t���~�~���v�!6�!6�~��z�!�a�%�'�'�*�*�*�*���6��?�@�@�@rLc�t�|j�d�d�|D������dS)Nr�c3�4K�|]}t|��V��dSr�r�r�s  rJr�z#LineMatcher._log.<locals>.<genexpr>_s(����(>�(>�A��Q���(>�(>�(>�(>�(>�(>rL)r�ryr�)rzr�s  rJr�zLineMatcher._log^s:���������(>�(>��(>�(>�(>� >� >�?�?�?�?�?rLc�6�d�|j��S)Nrj)r�r�r�s rJ�	_log_textzLineMatcher._log_textas���y�y��)�*�*�*rLF��consecutiver�c�F�d}|�|td|���dS)a�Check lines exist in the output (using :func:`python:fnmatch.fnmatch`).

        The argument is a list of lines which have to match and can use glob
        wildcards.  If they do not match a pytest.fail() is called.  The
        matches and non-matches are also shown as part of the error message.

        :param lines2: String patterns to match.
        :param consecutive: Match lines consecutively?
        Trr�N)�_match_linesr�rzr�r�r�s    rJr�zLineMatcher.fnmatch_lineses-��!�����&�'�9�+��N�N�N�N�NrLc�>�d}|�|d�d|���dS)a�Check lines exist in the output (using :func:`python:re.match`).

        The argument is a list of lines which have to match using ``re.match``.
        If they do not match a pytest.fail() is called.

        The matches and non-matches are also shown as part of the error message.

        :param lines2: string patterns to match.
        :param consecutive: match lines consecutively?
        Tc�F�ttj||����Sr�r�r�s  rJr�z,LineMatcher.re_match_lines.<locals>.<lambda>�s��d�2�8�C��#6�#6�7�7�rL�re.matchr�N)r�r�s    rJ�re_match_lineszLineMatcher.re_match_linests@��!������7�7��#�		�	
�	
�	
�	
�	
rL�match_nicknamec���t|tjj��s$t	dt|��j�����|�|��}|jdd�}g}d}t|��dz}d}	|D�]�}
d}|�r�|�
d��}|
|kr'|�dt|
����d}	�n�|||
��rb|�d|zt|
����|�d	�
d
|���t|����d}	�n&|ri|	rgd|
��}
|�|
��|�d	�
d
|���t|����|�|
��|s:|�d	�
d
|���t|
����d}|�d	�
d|���t|����|�|��|���d|
��}
|�|
��|�|
�����g|_dS)aqUnderlying implementation of ``fnmatch_lines`` and ``re_match_lines``.

        :param Sequence[str] lines2:
            List of string patterns to match. The actual format depends on
            ``match_func``.
        :param match_func:
            A callable ``match_func(line, pattern)`` where line is the
            captured line from stdout/stderr and pattern is the matching
            pattern.
        :param str match_nickname:
            The nickname for the match function that will be logged to stdout
            when a match occurs.
        :param consecutive:
            Match lines consecutively?
        zinvalid type for lines2: NTrlFrzexact match:z%s:�{:>{width}}�with:��widthzno consecutive match: �nomatch:�and:zremains unmatched: )r��collections�abcr�	TypeErrorrCr�r�rr�r�r�r�rr�ryr�)rzr�r�r�r�r��
extralinesr��wnick�startedr`�nomatchprinted�nextliner�s              rJr�zLineMatcher._match_lines�s���.�&�+�/�":�;�;�	Q��O��V���8M�O�O�P�P�P�����'�'����A�A�A����
� ���N�#�#�a�'�����!	 �!	 �D�"�N��
 �!�:�:�a�=�=���8�#�#��I�I�n�d�4�j�j�9�9�9�"�G���Z��$�/�/�Y��I�I�e�n�4�d�4�j�j�A�A�A��I�I�%�,�,�W�E�,�B�B�D��N�N����#�G��"�(�w�(�?�t�?�?���	�	�#�����	�	�)�0�0���0�F�F��X�������
�
�3����)�.��	�	�)�0�0��5�0�I�I�4�PT�:�:����*.���I�I�m�2�2�6��2�G�G��h���X�X�X��!�!�(�+�+�+�7�
 �:5�D�4�4���	�	�#�����
�
�3���������rLr�c�B�d}|�|td��dS)z�Ensure captured lines do not match the given pattern, using ``fnmatch.fnmatch``.

        :param str pat: The pattern to match lines.
        TrN)�_no_match_liner�rzr�r�s   rJ�no_fnmatch_linezLineMatcher.no_fnmatch_line�s(��
!�����C��)�4�4�4�4�4rLc�:�d}|�|d�d��dS)z�Ensure captured lines do not match the given pattern, using ``re.match``.

        :param str pat: The regular expression to match lines.
        Tc�F�ttj||����Sr�r�r�s  rJr�z.LineMatcher.no_re_match_line.<locals>.<lambda>�s��4����d�(;�(;�#<�#<�rLr�N)rr	s   rJ�no_re_match_linezLineMatcher.no_re_match_line�s7��
!������<�<�j�	
�	
�	
�	
�	
rLc�(�d}d}t|��dz}|jD]�}|||��rj|�d|��}|�|��|�d�d|���t	|����|�|���x|s:|�d�d|���t	|����d}|�d�d	|���t	|������g|_d
S)z�Ensure captured lines does not have a the given pattern, using ``fnmatch.fnmatch``.

        :param str pat: The pattern to match lines.
        TFrlz: r�r�r�r�r�N)r�rr�rr�r�r�)	rzr�r�r�r��nomatch_printedrr`r�s	         rJrzLineMatcher._no_match_line�s"��!�����N�#�#�a�'���J�
	Q�
	Q�D��z�$��$�$�	
Q�'�2�2�3�2�2���	�	�#�����	�	�-�.�.�w�e�.�D�D�d�4�j�j�Q�Q�Q��
�
�3�����&�+��I�I�m�2�2�:�U�2�K�K�T�RU�Y�Y�W�W�W�&*�O��	�	�-�.�.�v�U�.�C�C�T�$�Z�Z�P�P�P�P�����rLr�c�D�d}|j}g|_t|��dS)NT)r�r�r,)rzr�r��log_texts    rJr�zLineMatcher._fail�s&�� ���>������X�����rLc� �t|��S)z Return the entire original text.r�r�s rJrozLineMatcher.str�s���4�y�y�rLr7)r�r�r�r�rror�r�rrrr�r�r�rrvr�r�r�r�r�r�r�r�r
r
rr�r�rLrJr<r<sM��������)�d�3�i�)�D�)�)�)�)�%��%�%�%�%���c�8�C�=�&�&@� A��h�s�m�����2�8�C�=�2�T�2�2�2�2�
V�H�S�M�V�d�V�V�V�V�

 ��s�m�
 �19�3��*�d�:J�1K�
 �	
�
 �
 �
 �
 �A�c�A�h�s�m�A�A�A�A�@�@�@�@��+�3�+�+�+��X�+�=B�
O�
O�
O��s�m�
O�59�
O�	
�
O�
O�
O�
O� =B�
�
�
��s�m�
�59�
�	
�
�
�
�
�6"�
A�A�A���
�A��c�3�Z��-�.�A��	A��
A�
�A�A�A�A�F5�3�5�4�5�5�5�5�
�C�
�D�
�
�
�
����$,�c�3�Z��-=�$>��PS��	
�����.���������S������rL)r:r9)sr��collections.abcr�r�r�r?rtrpr�r�rrEr�rPr�ior�pathlibr�typingrrrr	r
rrr
rrrrrrr�weakrefr�	iniconfigrrr�r�
_pytest._coder�_pytest.capturer�_pytest.compatrrrrNrrr r!r"r#�_pytest.config.argparsingr$�_pytest.deprecatedr%�_pytest.fixturesr&r'�_pytest.mainr(�_pytest.monkeypatchr)�
_pytest.nodesr*r+�_pytest.outcomesr,r-r.�_pytest.pathlibr/r0r1�_pytest.reportsr2r3�_pytest.tmpdirr4�_pytest.warning_typesr5�typing_extensionsr6r7r��pytest_pluginsrxrKrWrQr�ror�r�r�r;r?rDrKrP�compilerirkrRrwrGrFrBr9r<r�rLrJ�<module>r*sQ������������	�	�	�	�����
�
�
�
�	�	�	�	�����	�	�	�	�
�
�
�
�����
�
�
�
����������������������������������������������������������������������������������������������������� � � � � � �������%�%�%�%�%�%�������$�$�$�$�$�$������� � � � � � �-�-�-�-�-�-� � � � � � �!�!�!�!�!�!�%�%�%�%�%�%�(�(�(�(�(�(�!�!�!�!�!�!�#�#�#�#�#�#�#�#�#�#�#�#�������.�.�.�.�.�.�,�,�,�,�,�,�-�-�-�-�-�-�$�$�$�$�$�$�+�+�+�+�+�+� � � � � � �+�+�+�+�+�+�#�#�#�#�#�#�������!�!�!�!�!�!�)�)�)�)�)�)�!�!�!�!�!�!�'�'�'�'�'�'�$�$�$�$�$�$�-�-�-�-�-�-�)�)�)�)�)�)�&�&�&�&�&�&�*�*�*�*�*�*�/�/�/�/�/�/���'�'�'�'�'�'�)�)�)�)�)�)��N�N�N�(�(����
�
�V�������2
�V�
��
�
�
�
�?7�?7�?7�?7�?7�?7�?7�?7�J	��^������	�����������.�X�c�]�.�t�C�y�.�.�.�.�
�����������8�V�V�V�V�V�V�V���V�r	����	���	��m�������D��4G�������	�
L�
�
L�/>�
L�MX�
L��
L�
L�
L�	��
L� 	��y�!1�2����	���	�!�)�F�D�$�$6�7�!�!�!�	��!�"�r�z�-�0�0���b�j��(�(���g
�g
�g
�g
�g
�g
�g
���g
�T��������)�)�)�)�)�)�)�)�5�5�5�5�5�5�5�5��u
�u
�u
�u
�u
�u
�u
���u
�p2�2�2�2�2�2�2�2�$_�_�_�_�_�_�_�_�_�_rL