Current File : //usr/local/apps/python3/lib/python3.11/distutils/tests/__pycache__/test_config.cpython-311.pyc
�

�KeM���dZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZd	Z
d
ZdZGd�d
e
je
je
jej��ZGd�de��Zd�Zedkree����dSdS)z"Tests for distutils.pypirc.pypirc.�N)�
PyPIRCCommand)�Distribution)�
set_threshold)�WARN)�support)�run_unittestz�[distutils]

index-servers =
    server1
    server2
    server3

[server1]
username:me
password:secret

[server2]
username:meagain
password: secret
realm:acme
repository:http://another.pypi/

[server3]
username:cbiggles
password:yh^%#rest-of-my-password
z.[server-login]
username:tarek
password:secret
zI[distutils]
index-servers =
    pypi

[pypi]
username:tarek
password:xxx
c�(��eZdZ�fd�Z�fd�Z�xZS)�BasePyPIRCCommandTestCasec���tt|�����|���|_|jt
jd<|jt
jd<t
j�|jd��|_	t��|_Gd�dt��}||_
tt��|_dS)zPatches the environment.�HOME�USERPROFILEz.pypircc��eZdZd�Zd�ZeZdS)�0BasePyPIRCCommandTestCase.setUp.<locals>.commandc�0�tj||��dS�N)r�__init__)�self�dists  �E/usr/local/apps/python3/lib/python3.11/distutils/tests/test_config.pyrz9BasePyPIRCCommandTestCase.setUp.<locals>.command.__init__Ds���&�t�T�2�2�2�2�2�c��dSr�)rs r�initialize_optionszCBasePyPIRCCommandTestCase.setUp.<locals>.command.initialize_optionsFs���rN)�__name__�
__module__�__qualname__rr�finalize_optionsrrr�commandrCs4������
3�
3�
3�
�
�
�1���rrN)�superr
�setUp�mkdtemp�tmp_dir�os�environ�path�join�rcrrr�_cmdrr�
old_threshold)rr�	__class__s  �rr zBasePyPIRCCommandTestCase.setUp:s����
�'��.�.�4�4�6�6�6��|�|�~�~���!�\��
�6��$(�L��
�=�!��'�,�,�t�|�Y�7�7��� �N�N��	�	2�	2�	2�	2�	2�m�	2�	2�	2���	�*�4�0�0����rc�~��t|j��tt|�����dS)zRemoves the patch.N)rr)rr
�tearDown)rr*s �rr,z"BasePyPIRCCommandTestCase.tearDownMs7����d�(�)�)�)�
�'��.�.�7�7�9�9�9�9�9r)rrrr r,�
__classcell__)r*s@rr
r
5sQ�������
1�1�1�1�1�&:�:�:�:�:�:�:�:�:rr
c� �eZdZd�Zd�Zd�ZdS)�PyPIRCCommandTestCasec�*�|�|jt��|�|j��}|���}t
t|�������}gd�}|�	||��|�|jt��|���}t
t|�������}gd�}|�	||��dS)N)��password�secret��realm�pypi��
repositoryzhttps://upload.pypi.org/legacy/)�server�server1)�username�me)r1r4r7)r9zserver-login)r;�tarek)�
write_filer'�PYPIRCr(r�_read_pypirc�list�sorted�items�assertEqual�
PYPIRC_OLD�r�cmd�config�waiteds    r�test_server_registrationz.PyPIRCCommandTestCase.test_server_registrationUs���	
������(�(�(��i�i��	�"�"���!�!�#�#���f�V�\�\�^�^�,�,�-�-��=�=�=��	
�����(�(�(�	
������,�,�,��!�!�#�#���f�V�\�\�^�^�,�,�-�-��E�E�E��	
�����(�(�(�(�(rc�.�|�|j��}|���}|�tj�|����|�dd��|�tj�|����t|��}	|�
��}|�|t��|�
��dS#|�
��wxYw)Nr=�xxx)r(r�_get_rc_file�assertFalser#r%�exists�
_store_pypirc�
assertTrue�open�readrD�WANTED�close)rrGr'�f�contents     r�test_server_empty_registrationz4PyPIRCCommandTestCase.test_server_empty_registrationns����i�i��	�"�"��
�
�
�
�
����������+�+�,�,�,����'�5�)�)�)��������r�*�*�+�+�+���H�H��	��f�f�h�h�G����W�f�-�-�-�
�G�G�I�I�I�I�I��A�G�G�I�I�I�I���s�9/C>�>Dc�@�|�|jt��|�|j��}d|_|���}tt|�	������}gd�}|�
||��dS)N�server3))r2zyh^%#rest-of-my-passwordr4r7)r9rZ)r;�cbiggles)r>r'r?r(rr8r@rArBrCrDrFs    r�test_config_interpolationz/PyPIRCCommandTestCase.test_config_interpolation{s���������(�(�(��i�i��	�"�"��"����!�!�#�#���f�V�\�\�^�^�,�,�-�-��C�C�C��	
�����(�(�(�(�(rN)rrrrJrXr\rrrr/r/SsA������)�)�)�2���)�)�)�)�)rr/c�X�tj���t��Sr)�unittest�
TestLoader�loadTestsFromTestCaser/rrr�
test_suitera�s ���� � �6�6�7L�M�M�Mr�__main__)�__doc__r#r^�distutils.corerr�
distutils.logrr�distutils.testsr�test.supportrr?rErT�TempdirManager�LoggingSilencer�EnvironGuard�TestCaser
r/rarrrr�<module>rlsL��(�(�	�	�	�	�����(�(�(�(�(�(�'�'�'�'�'�'�'�'�'�'�'�'�������#�#�#�#�#�#�%�%�%�%�%�%�
��.�
�
��:�:�:�:�:�� 6�#�3�#�0�$�-�:�:�:�<3)�3)�3)�3)�3)�5�3)�3)�3)�lN�N�N��z����L�����������r