Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
pytest_plugin.cpython-313.pyc95 linesDownload Raw Back to __pycache__
1�

2�j�1��n�%SSKJr SSKrSSKrSSKrSSKJrJrJr SSK	J3r4Jr SSKJ
r
JrJr SSKJrJr SSKrSSKJrJr SSKJr SS	KJr SS5KJr SSKJr SS
KJ r J!r!J"r"J#r# SSK$J%r% SSK&J'r' \RPS:aSSK)J*r* Sq+S\,S'Sq-S\,S'Sq.S.Sjr/\S/Sj5r0S0Sjr1S1Sjr2\Rf"SS9S2Sj5r4\Rf"SS9S3Sj5r5S4S jr6\Rf"SS9S5S!j5r7\Rp"S"\"5S#9S6S$j5r9\RpS7S%j5r:\RpS8S&j5r;"S'S(5r<\Rp"SS)9S9S*j5r=\Rp"SS)9S9S+j5r>\RpS:S,j5r?\RpS;S-j5r@g)<�)�annotationsN)�Callable�	Generator�Iterator)�	ExitStack�contextmanager)�isasyncgenfunction�iscoroutinefunction�ismethod)�Any�cast)�FuncFixtureInfo�6SubRequest)�Exit)�	CallSpec2)�Scope�)�get_available_backends)�current_async_library�get_async_backend�reset_current_async_library�set_current_async_library)�iterate_exceptions)�7TestRunner)��)�ExceptionGroupzTestRunner | None�_current_runnerzExitStack | None�
_runner_stackc�F�[U[5(aU04$[U[5(ai[U5S:XaZ[US[5(aB[US[5(a*[[[[[[44U5$[S5e)N�rrz@anyio_backend must be either a string or tuple of (string, dict))�8isinstance�str�tuple�len�dictr
r�	TypeError)�backends �YD:\code\apps\devtools\python\user_packages\Python313\site-packages\anyio/pytest_plugin.py�extract_backend_and_optionsr*#s}���'�3�����{��	�G�U�	#�	#��G���(9��g�a�j�#�&�&�:�g�a�j�$�+G�+G���c�4��S��>�1�2�G�<�<�9�V�10W�W�c#�# �[ct[U5n[5q[	5c%[U5n[R
[U5 U=(d 0n[RURU55q[S-
q11[v� [S-q12[(d"[ce[R5 S=qqgg![S-q13[(d"[ce[R5 S=qqff=f7f�Nr)rrrrrr�callbackr�
enter_context�create_test_runner�_runner_leases�close)�backend_name�backend_options�asynclib�tokens    r)�14get_runnerr7-s����15��$�\�2��!��
� �"�*�.�l�;�E��"�"�#>��F�)�/�R��'�5�5��'�'��8�16���a��N�3����!����~� �,�,�,����!�.2�2�M�O���	�!����~� �,�,�,����!�.2�2�M�O��s�BD�C�7D�8C?�?Dc�&�URSSSS9 g)N�17anyio_mode�strictz-AnyIO plugin mode (either "strict" or "auto"))�default�help)�addini)�parsers r)�pytest_addoptionr?Ks��18�M�M���
<��r+c��URSS5 URS5S:Xa^URRS5(a=URS5S:Xa'UR	[19R"S5S5 gggg)	N�markerszManyio: mark the (coroutine function) test to be run asynchronously via anyio.r9�auto�asyncio�asyncio_modezlAnyIO auto mode has been enabled together with pytest-asyncio auto mode. This may cause unexpected behavior.r)�addinivalue_line�getini�
pluginmanager�20has_plugin�issue_config_time_warning�pytest�PytestConfigWarning)�configs r)�pytest_configurerMSs���21����W��22	�
�
�l�#�v�-�� � �+�+�I�6�6��M�M�.�)�V�3��(�(��&�&�<�
�
�	23�
4�
7�	.r+T)�hookwrapperc#�^^^# �SUUU4SjjnURm[T5(d[T5(a�SUR;azX lURnSUR;=m(dU=RS-
slSUR;=m(dU=RS-
slSv�TUlX0l$Sv�$!TUlX0lf=f7f)N�
anyio_backend�requestc;�># �UR(aa[T5(aQ[TR5[UR5La&TRRUR5nOTn[
U5upET(aXS'T	(aXS'[XE5n[U5(aURX25Shv�N OURX25v� SSS5 gN!!,(df   g=f7f)NrPrQ)�instancer�type�__self__�__func__�__get__r*r7r	�run_asyncgen_fixture�run_fixture)24rPrQ�kwargs�25local_funcr3r4�runner�func�has_backend_arg�has_request_args26       ���r)�wrapper�%pytest_fixture_setup.<locals>.wrapperhs�����
��������T�]�]�#�t�G�,<�,<�'=�=����.�.�w�/?�/?�@�J��J�(C�M�(R�%���&3�?�#�� '�9��
��
6�&�!�*�-�-�!�6�6�z�J�J�J��(�(��<�<�	7�
6�J�7�
6�s0�B#D�&%C/�C-�C/�$	D�-C/�/27C=�9D�rP�rQ)rPrrQrrZr�returnr)r]r	r28�fixturenames�argnames)�29fixturedefrQr`�original_argnamer]r^r_s    @@@r)�pytest_fixture_setuprifs�����=�=�4�?�?�D��$���#6�t�#<�#<��g�2�2�2�%�O�)�2�2��'6�*�:M�:M�'M�M�O�M��#�#�'9�9�#�'0�J�4G�4G�'G�G�O�G��#�#�|�3�#�
7��"&�30��&6�#��N��#'�31��&6�#�s�B/C�5C32�8C�33C�C)�tryfirstc��URX!5(a�[US5(aURROUn[	U5(a�UR34R
S5S:HnURS5n[USS5nU(dU(d[SU55(a&[RRS5"U5 gggg)	N�35hypothesisr9rB�anyio�36pytestmark�c3�># �UHoRS:Hv� M g7f)rmN)�name)�.0�markers  r)�	<genexpr>�,pytest_pycollect_makeitem.<locals>.<genexpr>�s���H�K�&�{�{�g�-�K�s�rP)
�istestfunction�hasattrrl�37inner_testr38rLrF�get_closest_marker�getattr�anyrJ�mark�usefixtures)�	collectorrq�obj�39inner_func�anyio_auto_moders�own_markerss       r)�pytest_pycollect_makeitemr��s�������*�*�29�#�|�2L�2L�S�^�^�.�.�RU�40��z�*�*�'�.�.�5�5�l�C�v�M�O��1�1�'�:�F�!�#�|�R�8�K����H�K�H�H�H����'�'��8��=�I�+�+r+�sessionc�j�[[[UR555GH�up[	U[41R5(dM'[UR5(dMCURS5cMWSUR;dMi/n[R"[5Vs1sHoDRiM nn[[#55GH upgSU;a#[SU0SU0S[$R&0U//S9nO#[0SU0SU0S[$R&0U//S9nUR(n	[U	R*5n42SU43;aU44R-S5 [/U	R0U	R2U45U	R4S9n[46RR7UR8UR:SUS3UUR<UUR>UR:S	9nUR-U5 GM# X0RXS47-&GM� gs snf![a [!5nGNjf=f)NrmrP�48_arg2scope)�params�indicesr��_idlist�marks)�funcargsr�r��	arg2scope�idlistr�)rf�initialnames�
names_closure�name2fixturedefs�[�])rq�callspec�callobj�fixtureinfo�keywords�originalnamer) �reversed�list�	enumerate�itemsr"rJ�Functionr49�functionryre�dataclasses�fieldsrrqr'�setrr�Module�_fixtureinfor��appendrrfr�r��from_parent�parentr�rr�)
r��i�item�	new_items�f�	cs_fields�param_indexr(r��fi�new_names_closure�new_fixtureinfo�new_items
             r)�pytest_collection_finishr��s����D��7�=�=�!9�:�;����t�V�_�_�-�-�#�D�M�M�2�2��'�'��0�<��t�'8�'8�8��I�
"�-8�-?�-?�	�-J�K�-J��V�V�-J�	�K�)2�2H�2J�(K�$���9�,�(� /��9�!0�+� >�$3�U�\�\�#B�!(�	� � �H� )�!#� /��9�!0�+� >�#2�E�L�L�"A� '�y� �
 �H��&�&��$(��)9�)9�$:�!�"�*;�;�%�,�,�_�=�"1��[�[�!#���"3�%'�%8�%8�	#��"�?�?�6�6��K�K� �-�-�.�a��y��:�%� �H�H� /�!�]�]�!%�!2�!2�7���� � ��*�O)L�R(1�M�M�!�!�e�$�m<��L���
"��E�	�
"�s$�H�0H�H�H�H2�1H2c	�>^	^50^�SU	U51U4SjjnURRS5nU(Ga[U5um	m52[URS5(aeURR53RmTRUR:wa*[T5(aXRR54lg[UR5(ahURnURRVs0sHoDX4_M	 nn[T	T555nURURU5 SSS5 ggs snf![a:n[U5H%n[U[ ["[$45(dM%X�e eSnAff=f!,(df   g=f)Nc�v>�[TT5nURTU5 SSS5 g!,(df   g=f�N)r7�run_test)rZr\r3r4�
original_funcs  ���r)�run_with_hypothesis�/pytest_pyfunc_call.<locals>.run_with_hypothesis�s)���
��o�
6�&��O�O�M�6�2�7�
6�
6�s�*�568rPrlT)rZrrd�None)r��getr*rwrrlrx�__qualname__r57r�rfr7r�rrr"r�KeyboardInterrupt�58SystemExit)�59pyfuncitemr�r(r��arg�testargsr\�excgrp�excr3r4r�s         @@@r)�pytest_pyfunc_callr��sV���3�3��!�!�%�%�o�6�G��(C�G�(L�%��o��:�>�>�<�0�0�&�N�N�5�5�@�@�M��)�)�-@�-M�-M�M�&�}�5�5�;N�N�N�-�-�8���z�~�~�.�.�!�*�*�H�6@�6M�6M�6V�6V�W�6V�s�X�]�*�6V�H�W��L�/�:�f���O�O�J�N�N�H�=�;����X��&��1�&�9��%�c�D�2C�Z�+P�Q�Q�"%�1� :�����;�:��s6�=E�F�E�60F�,F�F�F�F�61F�module)�scoper�c��UR$r�)�paramrcs r)rPrPs���=�=�r+c�:�[U[5(aU$US$)Nr�r"r#rbs r)�anyio_backend_namer�
s ���-��%�%����Q��r+c�:�[U[5(a0$US$r-r�rbs r)�anyio_backend_optionsr�s���-��%�%��	��Q��r+c�D�\rSrSrSrSSjr\S	Sj5rS62SSjjrSr	g)�FreePortFactoryia+63Manages port generation based on specified socket kind, ensuring no duplicate64ports are generated.65 66This class provides functionality for generating available free ports on the67system. It is initialized with a specific socket kind and can generate ports68for given address families while avoiding reuse of previously generated ports.69 70Users should not instantiate this class directly, but use the71``free_tcp_port_factory`` and ``free_udp_port_factory`` fixtures instead. For simple72uses cases, ``free_tcp_port`` and ``free_udp_port`` can be used instead.73c�>�Xl[["5Ulgr�)�_kindr��int�74_generated)�self�kinds  r)�__init__�FreePortFactory.__init__+s���75��c�(�*��r+c��UR$)z�76The type of socket connection (e.g., :data:`~socket.SOCK_STREAM` or77:data:`~socket.SOCK_DGRAM`) used to bind for checking port availability78 79)r�)r�s r)r��FreePortFactory.kind/s���z�z�r+Nc�x�UbU/nOE[R/n[R(aUR[R5 Sn[5nUHynUR
[R"XR55nU[R:XaSOSnURXc45 U(aMfUR5SnM{ X0R;a&URRU5 UsSSS5 $SSS5 M�![a  Mf=f!,(df   N"=f)z�80Return an unbound port for the given address family.81 82:param family: if omitted, both IPv4 and IPv6 addresses will be tried83:return: a port number84 85Nrz::1z	127.0.0.1r)
�socket�AF_INET�has_ipv6r��AF_INET6rr/r��bind�OSError�getsocknamer��add)r��family�families�port�stack�sock�addrs       r)�__call__�FreePortFactory.__call__8s������x�H����'�H����������0���D����&�F� �.�.�v�}�}�V�Z�Z�/P�Q�D�$*�f�o�o�$=�5�;�D���	�	�4�,�/� �4�#�/�/�1�!�4��'��?�?�2����+�+�D�1�#������#�����
��s8�A
D+�(D�:D+�AD+�86D(�#D+�'D(�(D+�+87D9)r�r�)r��socket.SocketKindrdr�)rdr�r�)r�zsocket.AddressFamily | Nonerdr�)88�__name__�89__module__r��__firstlineno__�__doc__r��propertyr�r��__static_attributes__ror+r)r�r�s*���%�����$�$r+r�)r�c�4�[[R5$r�)r�r��SOCK_STREAMror+r)�free_tcp_port_factoryr�Zs���6�-�-�.�.r+c�4�[[R5$r�)r�r��90SOCK_DGRAMror+r)�free_udp_port_factoryr�_s���6�,�,�-�-r+c��U"5$r�ro)r�s r)�
free_tcp_portr�d��� �"�"r+c��U"5$r�ro)r�s r)�
free_udp_portr�ir�r+)r(�objectrdztuple[str, dict[str, Any]])r3r#r4�dict[str, Any]rdzIterator[TestRunner])r>z
pytest.Parserrdr�)rLz
pytest.Configrdr�)rgrrQrrdzGenerator[Any])r~zpytest.Module | pytest.Classrqr#rr�rdr�)r�zpytest.Sessionrdr�)r�rrdzbool | None)rQrrdr)rPrrdr#)rPrrdr�)rdr�)r��Callable[[], int]rdr�)r�r�rdr�)A�91__future__rr�r��sys�collections.abcrrr�92contextlibrr�inspectr	r93r�typingrr
rJ�_pytest.fixturesrr�_pytest.outcomesr�_pytest.pythonr�
_pytest.scoper�r�_core._eventlooprrrr�_core._exceptionsr�abcr�version_info�exceptiongrouprr�__annotations__rr1r*r7r?rM�hookimplrir�r�r��fixturerPr�r�r�r�r�r�r�ror+r)�<module>rs���"��
�94�9�9�0�E�E��
�8�!�$��$���2�����g��-�%)��"�)�"&�
��&���X��3��3�(6�3��3��3�:�95�&���T�"�-�#�-�`���$��>�+�>�36�>�=C�>�	�>� �>�"71�t���$��!� �!�H���h�'=�'?�@��A����� �� ���� �� �:$�:$�z���i� �/�!�/����i� �.�!�.����#��#����#��#r+
codekingpro/portable-devtools · Team Ai