HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1784574/root/usr/lib/python3/dist-packages/pbr/tests/__pycache__/
Upload File :
Current File : //proc/1784574/root/usr/lib/python3/dist-packages/pbr/tests/__pycache__/base.cpython-311.pyc
�

㦧b�"����dZddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
Gd�dej��ZGd�dej
ej��ZGd	�d
ej��Zd�Zd�ZdS)
z Common utilities used in testing�N)�content)�optionsc�(��eZdZdZd�Z�fd�Z�xZS)�DiveDirzaDive into given directory and return back on cleanup.

    :ivar path: The target directory.
    c��||_dS�N)�path)�selfr	s  �0/usr/lib/python3/dist-packages/pbr/tests/base.py�__init__zDiveDir.__init__=s
����	�	�	�c����tt|�����|�tjt	j����t	j|j��dSr)�superr�setUp�
addCleanup�os�chdir�getcwdr	)r
�	__class__s �rrz
DiveDir.setUp@sS���
�g�t���"�"�$�$�$������"�)�+�+�.�.�.�
��������r
��__name__�
__module__�__qualname__�__doc__rr�
__classcell__�rs@rrr7sQ���������
�����������r
rc�>��eZdZ�fd�Zd�Zd�Zd�Zgddfd�Z�xZS)�BaseTestCasec����tt|�����tj�dd��}	t
|��}n!#t$rtd��d}YnwxYw|dkr)|�	tj|d�����tj�d��tj
vrT|�	tjd����j}|�	tjd	|����tj�d
��tj
vrT|�	tjd����j}|�	tjd|����|�	tjd
����|_|�	tj����|�	tj����|�	tj����|�	tjdd����|�	tj����j|_tj�|jd��|_t7jtj�tj�t<��d��|j��|�tj tj!����tj |j��|�|j"��tG|dd��s�|�	tjd����tj�|jd��}tI|d��5}|�%��}ddd��n#1swxYwY|j&dd��}tI|d��5}|�'|��ddd��dS#1swxYwYdSdS)N�OS_TEST_TIMEOUT�z=OS_TEST_TIMEOUT set to invalid value defaulting to no timeoutrT)�gentle�OS_STDOUT_CAPTURE�stdoutz
sys.stdout�OS_STDERR_CAPTURE�stderrz
sys.stderr�pbr�PBR_VERSIONz0.0�testpackage�preversionedz	setup.cfg�rtzversion = 0.1.dev��wt)(rrrr�environ�get�int�
ValueError�print�
useFixture�fixtures�Timeoutr�TRUE_VALUES�StringStream�stream�MonkeyPatch�
FakeLogger�log_fixture�TempHomeDir�NestedTempfile�EnvironmentVariable�TempDirr	�temp_dir�join�package_dir�shutil�copytree�dirname�__file__rrr�_discard_testpackage�getattr�open�read�replace�write)r
�test_timeoutr$r&�setup_cfg_path�cfgrrs       �rrzBaseTestCase.setUpHs���
�l�D�!�!�'�'�)�)�)��z�~�~�&7��<�<��	��|�,�,�L�L���	�	�	��.�
/�
/�
/��L�L�L�		����
�!����O�O�H�,�\�$�G�G�G�H�H�H�
�:�>�>�-�.�.�'�2E�E�E��_�_�X�%:�8�%D�%D�E�E�L�F��O�O�H�0��v�F�F�G�G�G�
�:�>�>�-�.�.�'�2E�E�E��_�_�X�%:�8�%D�%D�E�E�L�F��O�O�H�0��v�F�F�G�G�G��?�?����&�&�(�(���	
����,�.�.�/�/�/�����/�1�1�2�2�2�����+�-�-�.�.�.�	
����4�]�E�J�J�K�K�K�����(8�(:�(:�;�;�@��
��7�<�<��
�}�E�E���������R�W�_�_�X�%>�%>�
�N�N��(�	*�	*�	*������"�)�+�+�.�.�.�
���!�"�"�"�����1�2�2�2��t�^�T�2�2�	#��O�O�H�8��G�G�H�H�H��W�\�\�$�*:�K�H�H�N��n�d�+�+�
%�s��(�(�*�*��
%�
%�
%�
%�
%�
%�
%�
%�
%�
%�
%����
%�
%�
%�
%�%�g�o�&:�C�@�@�G��n�d�+�+�
#�s��	�	�'�"�"�"�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#�
#����
#�
#�
#�
#�
#�
#�
	#�	#s6�
A�A8�7A8�3P�P�P�Q#�#Q'�*Q'c��ttj��D]*}|dks|�d��r
tj|=�+dS)N�pbr_testpackagezpbr_testpackage.)�list�sys�modules�
startswith)r
�ks  rrGz!BaseTestCase._discard_testpackage{sR���c�k�"�"�	#�	#�A��&�&�&��L�L�!3�4�4�'��K��N��	#�	#r
c� �|jd|fi|��S)Nr'��_run_cmd�r
�args�kwargss   r�run_pbrzBaseTestCase.run_pbr�s���t�}�U�D�3�3�F�3�3�3r
c�:�|jtjd|zfi|��S)N)zsetup.py)rYrS�
executablerZs   r�	run_setupzBaseTestCase.run_setup�s%���t�}�S�^�]�T�-A�L�L�V�L�L�Lr
TNc��|p|j}t|gt|��z|���}|dr|std|dz���|S)afRun a command in the root of the test working copy.

        Runs a command, with the given argument list, in the root of the test
        working copy--returns the stdout and stderr streams and the exit code
        from the subprocess.

        :param cwd: If falsy run within the test package dir, otherwise run
            within the named path.
        )�cwd�zCommand failed retcode=%s)rBrYrR�	Exception)r
�cmdr[�
allow_failrb�results      rrYzBaseTestCase._run_cmd�sb���%�T�%���3�%�$�t�*�*�,�#�6�6�6���!�9�	E�Z�	E��7�&��)�C�D�D�D��
r
)	rrrrrGr]r`rYrrs@rrrFs��������1#�1#�1#�1#�1#�f#�#�#�4�4�4�M�M�M�"$��$��������r
rc�,��eZdZdZ�fd�Z�fd�Z�xZS)�CapturedSubprocessa)Run a process and capture its output.

    :attr stdout: The output (a string).
    :attr stderr: The standard error (a string).
    :attr returncode: The return code of the process.

    Note that stdout and stderr are decoded from the bytestrings subprocess
    returns using error=replace.
    c���tt|�����||_||_||_tj|jd<tj|jd<tj|jd<dS)z�Create a CapturedSubprocess.

        :param label: A label for the subprocess in the test log. E.g. 'foo'.
        :param *args: The *args to pass to Popen.
        :param **kwargs: The **kwargs to pass to Popen.
        r&�stdinr$N)rrir�labelr[r\�
subprocess�PIPE)r
rlr[r\rs    �rrzCapturedSubprocess.__init__�sg���	� �$�'�'�0�0�2�2�2���
���	���� *����H��)����G�� *����H���r
c���tt|�����tj|ji|j��}|���\}}|�dd��|_	|�dd��|_
|�|jdztj|j	����|�|jdztj|j
����|j|_|jr't!d|j�d|j�d|j�����|�t$|d��|�t$|d	��|�t$|d
��dS)Nzutf-8rKz-stdoutz-stderrzFailed process args=z	, kwargs=z
, returncode=�out�err�
returncode)rrirrm�Popenr[r\�communicate�decoderprq�	addDetailrlr�text_contentrr�AssertionErrorr�delattr)r
�procrprqrs    �rrzCapturedSubprocess.setUp�sU���
� �$�'�'�-�-�/�/�/�����:�d�k�:�:���#�#�%�%���S��:�:�g�y�1�1����:�:�g�y�1�1������t�z�I�-�w�/C�D�H�/M�/M�N�N�N����t�z�I�-�w�/C�D�H�/M�/M�N�N�N��/����?�	>� �.��I�I�I�t�{�{�{�D�O�O�=�>�>�
>�	
�����u�-�-�-������u�-�-�-������|�4�4�4�4�4r
rrs@rriri�s[���������
0�
0�
0�
0�
0�5�5�5�5�5�5�5�5�5r
ric��tdd�|��z��tj|tjtjtj|���}td�|���D����}td��t|d��td��t|d��||jfzS)	z�Run the command args in cwd.

    :param args: The command to run e.g. ['git', 'status']
    :param cwd: The directory to run the comamnd in.
    :return: ((stdout, stderr), returncode)
    z
Running %s� )rkr$r&rbc3�dK�|]+}|�d�����V��,dS)�latin1N)ru�strip)�.0�ss  r�	<genexpr>z_run_cmd.<locals>.<genexpr>�s:����H�H�1�A�H�H�X�&�&�,�,�.�.�H�H�H�H�H�Hr
zSTDOUT:rzSTDERR:�)r2rArmrsrn�tuplertrr)r[rb�p�streamss    rrYrY�s���
�,����$���
'�(�(�(����J�O�J�O���C�	)�	)�	)�A��H�H��
�
���H�H�H�H�H�G�	�)����	�'�!�*����	�)����	�'�!�*��������&�&r
c�r�tgd�d��tgd�d��tgd�d��dS)N)�git�config�--globalz
user.email�example@example.com)r�r�r�z	user.namezOpenStack Developer)r�r�r�zuser.signingkeyr�rX�r
r�_config_gitr��sp���J�J�J�����
�I�I�I�����
�	 �	 �	 �!%�'�'�'�'�'r
)rrrCrmrSr4�
testresources�	testtoolsrr'r�Fixturer�TestCase�ResourcedTestCaserrirYr�r�r
r�<module>r�s8��P'�&�	�	�	�	�
�
�
�
�����
�
�
�
������������������������������h�����Q�Q�Q�Q�Q�9�%�}�'F�Q�Q�Q�h)5�)5�)5�)5�)5��)�)5�)5�)5�X'�'�'�&	'�	'�	'�	'�	'r