%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/test/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/test/__pycache__/test_iutils.cpython-312.pyc |
� Ϫ�f@5 � �� � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m Z mZmZ ddl mZ ddlmZ ddlmZ ddlmZmZ G d � d e� Z G d� de� Z G d � de� Zy)zD Test running processes with the APIs in L{twisted.internet.utils}. � N)�skipIf)�error� interfaces�reactor�utils)�Deferred)�platform)�SuppressedWarningsTests)�SynchronousTestCase�TestCasec �� � e Zd ZdZ ej ed� �dZdZdZ e j Zd� Z d� Zd� Zd� Zd� Zd � Z e ej* � d � d� � Zd� Zd � Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zy)�ProcessUtilsTestszt Test running a process using L{getProcessOutput}, L{getProcessValue}, and L{getProcessOutputAndValue}. Nz)reactor doesn't implement IReactorProcessc � � | j � }t |d� 5 }|j t j j |� t j z � ddd� t j j |� S # 1 sw Y �(xY w)zj Write the given list of lines to a text file and return the absolute path to it. �wtN)�mktemp�open�write�os�linesep�join�path�abspath)�self�sourceLines�script� scriptFiles �:/usr/lib/python3/dist-packages/twisted/test/test_iutils.py�makeSourceFilez ProcessUtilsTests.makeSourceFile$ sk � � ����� �&�$� � H�:����R�Z�Z�_�_�[�9�B�J�J�F�G� H��w�w���v�&�&� H� H�s �A B�B c � � | j g d�� }t j | j d|g� }|j | j d� S )z� L{getProcessOutput} returns a L{Deferred} which fires with the complete output of the process it runs after that process exits. )� import syszfor s in b'hello world\n':z s = bytes([s])z sys.stdout.buffer.write(s)z sys.stdout.flush()�-us hello world �r r �getProcessOutput�exe�addCallback�assertEqual�r r �ds r �test_outputzProcessUtilsTests.test_output. sN � � �(�(� � � � �"�"�4�8�8�d�J�-?�@���}�}�T�-�-�/?�@�@� c �� � � � j ddg� }t j � j d|g� }� j |t � }� fd�}|j |� |S )z� The L{Deferred} returned by L{getProcessOutput} is fired with an L{IOError} L{Failure} if the child process writes to stderr. r z!sys.stderr.write("hello world\n")r! c �X �� �j | j t j � S �N)� assertFailure�processEndedr �ProcessDone)�errr s �r �cbFailedz?ProcessUtilsTests.test_outputWithErrorIgnored.<locals>.cbFailedL s"