관리-도구
편집 파일: test_popen_docs.cpython-311.pyc
� �܋f � � � d dl mZmZ d� ZdZd dlmZ d dlmZ d dl m Z mZmZm Z d dlmZmZ G d� d e� � Z G d � de� � Zd� Zd S )� )�Popen�PIPEc � � t g d�t t �� � } | � � � \ }}| j rt d� � �|S )N��svn�lsz-R�foo��stdout�stderr�something bad happened)r r �communicate� returncode�RuntimeError)�process�out�errs �s/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/testfixtures/tests/test_popen_docs.py�my_funcr sQ � ��.�.�.�t�D�I�I�I�G��"�"�$�$�H�C���� 5��3�4�4�4��J� z(testfixtures.tests.test_popen_docs.Popen)�TestCase)�call)�Replacer�ShouldRaise�compare�SequenceComparison)� MockPopen�PopenBehaviourc �b � e Zd Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z d � Zd � Zd� Z d� Zd � Zd� ZdS )� TestMyFuncc �� � t � � | _ t � � | _ | j � t | j � � | � | j j � � d S �N)r r r �r�replace�dotted_path� addCleanup�restore��selfs r �setUpzTestMyFunc.setUp sL � ��[�[�� ����������{�D�J�/�/�/�������'�'�'�'�'r c � � | j � ddd�� � t t � � d� � t j g d�t t �� � }t t j ||� � � g�� � d S )N� svn ls -R foo� o� er r �r r ��expected)r �set_commandr r r r � all_callsr )r) r s r �test_examplezTestMyFunc.test_example s� � �� ����t�D��I�I�I� �� � �4� � � � �*�7�7�7��T�R�R�R���������!�!�+ � � � � � � r c � � t j dddd�� � t t d� � � � 5 t � � d d d � � d S # 1 swxY w Y d S )Nr, r- r. � )r r r r )r r2 r r r r( s r �test_example_bad_returncodez&TestMyFunc.test_example_bad_returncode- s� � � ��/�$�t�%&� (� (� (� (� ��&>�?�?� @� @� � ��I�I�I� � � � � � � � � � � � ���� � � � � � s �A�A�Ac � � t � � } |j d� � |dt t d�� � }|� d� � \ }}t |j |j |j � d� � g�� � d S )N� a commandT�r r �shellr r0 )r r2 r r r r3 � root_call)r) r r r r s r �test_communicate_with_inputz&TestMyFunc.test_communicate_with_input6 s� � ��������+�&�&�&��%��D��T�J�J�J���&�&�u�-�-���S�����!��!�-�-�e�4�4�+ � � � � � � r c � � t � � } |j ddd�� � |dt t d�� � }t |j � � � d�� � t |j � � � d�� � d S )Nr9 s foos barr Tr: r0 )r r2 r r r �readr �r) r r s r � test_read_from_stdout_and_stderrz+TestMyFunc.test_read_from_stdout_and_stderrC s� � ��������+�f�V�D�D�D�D��%��D��T�J�J�J�����#�#�%�%��7�7�7�7����#�#�%�%��7�7�7�7�7�7r c �| � t � � } |j d� � |dt d�� � }|j � d� � |j � � � t |j |j |j j � d� � |j j � � � g�� � d S )Nr9 T)�stdinr; z some textr0 ) r r2 r rC �write�closer r3 r<