Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/test/__pycache__/test_iutils.cpython-39.pyc
Ðазад
a k�h@5 � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m Z mZmZ ddl mZ ddlmZ ddlmZ ddlmZmZ G d d � d e�ZG dd� de�ZG d d� de�ZdS )zD Test running processes with the APIs in L{twisted.internet.utils}. � N)�skipIf)�error� interfaces�reactor�utils)�Deferred)�platform)�SuppressedWarningsTests)�SynchronousTestCase�TestCasec @ s� e Zd ZdZe�ed�du r dZdZdZ e jZdd� Z dd� Zdd � Zd d� Zdd � Zdd� Zee�� d�dd� �Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� ZdS )%�ProcessUtilsTestszt Test running a process using L{getProcessOutput}, L{getProcessValue}, and L{getProcessOutputAndValue}. Nz)reactor doesn't implement IReactorProcessc C sV | � � }t|d��(}|�tj�|�tj � W d � n1 s@0 Y tj�|�S )zj Write the given list of lines to a text file and return the absolute path to it. ZwtN)�mktemp�open�write�os�linesep�join�path�abspath)�selfZsourceLines�script� scriptFile� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/test/test_iutils.py�makeSourceFile$ s 6z ProcessUtilsTests.makeSourceFilec C s. | � g d��}t�| jd|g�}|�| jd�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 �dr r r �test_output. s � zProcessUtilsTests.test_outputc sF � � ddg�}t�� jd|g�}� �|t�}� fdd�}|�|� |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 s � � | jtj�S �N)� assertFailureZprocessEndedr ZProcessDone)�err�r r r �cbFailedL s z?ProcessUtilsTests.test_outputWithErrorIgnored.<locals>.cbFailed)r r r r r&