Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/test/__pycache__/ |
Upload File : |
o �b@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 rdZdZdZ 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 w Y tj�|�S )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� scriptFile� r �:/usr/lib/python3/dist-packages/twisted/test/test_iutils.py�makeSourceFile$ s �z 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)� assertFailure�processEndedr �ProcessDone)�err�r r r �cbFailedL � z?ProcessUtilsTests.test_outputWithErrorIgnored.<locals>.cbFailed)r r r r! r( �IOErrorr"