AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
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 :  /usr/lib/python3/dist-packages/twisted/trial/_dist/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/trial/_dist/__pycache__/worker.cpython-310.pyc
o

�b�$�@sdZddlZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZdd	lmZdd
lmZmZmZmZddlmZddlmZmZdd
lmZGdd�de�ZGdd�de�Zee�Gdd�d��Zee�Gdd�d��Z Gdd�de
�Z!dS)z:
This module implements the worker classes.

@since: 12.3
�N)�implementer)�Deferred)�IAddress�
ITransport)�ProcessProtocol)�AMP)�Failure)�namedObject)�_WORKER_AMP_STDIN�_WORKER_AMP_STDOUT�managercommands�workercommands)�WorkerReporter)�
TestLoader�
TrialSuite)�Todoc@sBeZdZdZd
dd�Zdd�Zej�e�dd�Z	ej
�e	�d	S)�WorkerProtocolz5
    The worker-side trial distributed protocol.
    FcCst�|_t|�|_||_dS�N)r�_loaderr�_result�_forceGarbageCollection)�self�forceGarbageCollection�r�</usr/lib/python3/dist-packages/twisted/trial/_dist/worker.py�__init__&s

zWorkerProtocol.__init__cCs.|j�|�}t|g|j�}|�|j�ddiS)z*
        Run a test case by name.
        �successT)r�
loadByNamerr�runr)r�testCase�case�suiterrrr+szWorkerProtocol.runcCst�|�ddiS)zb
        Set up the worker, moving into given directory for tests to run in
        them.
        rT)�os�chdir)r�	directoryrrr�start6s
zWorkerProtocol.startN)F)�__name__�
__module__�__qualname__�__doc__rrr
�Run�	responderr%�Startrrrrr!s
	rc@s�eZdZdZdd�Zej�e�dd�Zdd�Z	ej
�e	�dd	�Zej�e�d
d�Z
ej�e
�dd
�Zej�e�dd�Zej�e�dd�Zej�e�dd�Zdd�Zdd�ZdS)�LocalWorkerAMPz7
    Local implementation of the manager commands.
    cCs|j�|j�ddiS)z0
        Add a success to the reporter.
        rT)r�
addSuccess�	_testCase)r�testNamerrrr.FszLocalWorkerAMP.addSuccessc	CsZt|�}t||�}tdt|�d�D]}|j�||||dt||d�ggf�q|S)a�
        Helper to build a C{Failure} with some traceback.

        @param error: An C{Exception} instance.

        @param errorClass: The class name of the C{error} class.

        @param frames: A flat list of strings representing the information need
            to approximatively rebuild C{Failure} frames.

        @return: A L{Failure} instance with enough information about a test
           error.
        r���)r	r�range�len�frames�append�int)r�error�
errorClassr6�	errorType�failure�irrr�
_buildFailureOs
$�zLocalWorkerAMP._buildFailurecC�&|�|||�}|j�|j|�ddiS)z/
        Add an error to the reporter.
        rT)r>r�addErrorr/)rr0r9r:r6r<rrrr@e�zLocalWorkerAMP.addErrorcCr?)z0
        Add a failure to the reporter.
        rT)r>r�
addFailurer/)rr0�fail�	failClassr6r<rrrrBorAzLocalWorkerAMP.addFailurecC�|j�|j|�ddiS)z-
        Add a skip to the reporter.
        rT)r�addSkipr/)rr0�reasonrrrrFy�zLocalWorkerAMP.addSkipcCs"t|�}|j�|j||�ddiS)z:
        Add an expected failure to the reporter.
        rT)rr�addExpectedFailurer/)rr0r9�todo�_todorrrrI�sz!LocalWorkerAMP.addExpectedFailurecCrE)z<
        Add an unexpected success to the reporter.
        rT)r�addUnexpectedSuccessr/)rr0rJrrrrL�rHz#LocalWorkerAMP.addUnexpectedSuccesscCs"|j�|d�|j��ddiS)z4
        Print test output from the worker.
        �
rT)�_testStream�write�flush)r�outrrr�	testWrite�s
zLocalWorkerAMP.testWritecCs|j�|j�|S)zL
        Stop the current running test case, forwarding the result.
        )r�stopTestr/)r�resultrrr�	_stopTest�szLocalWorkerAMP._stopTestcCs<||_||_|j�|�|��}|jtj|d�}|�|j�S)z
        Run a test.
        )r)	r/r�	startTest�id�
callRemoter
r*�addCallbackrU)rrrT�
testCaseId�drrrr�szLocalWorkerAMP.runcCs
||_dS)z?
        Set the stream used to log output from tests.
        N)rN)r�streamrrr�
setTestStream�s
zLocalWorkerAMP.setTestStreamN)r&r'r(r)r.r�
AddSuccessr+r>r@�AddErrorrB�
AddFailurerF�AddSkiprI�AddExpectedFailurerL�AddUnexpectedSuccessrR�	TestWriterUrr]rrrrr-As(r-c@seZdZdZdS)�LocalWorkerAddressz
    A L{IAddress} implementation meant to provide stub addresses for
    L{ITransport.getPeer} and L{ITransport.getHost}.
    N)r&r'r(r)rrrrre�srec@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�LocalWorkerTransportzi
    A stub transport implementation used to support L{AMP} over a
    L{ProcessProtocol} transport.
    cCs
||_dSr)�
_transport)r�	transportrrrr�s
zLocalWorkerTransport.__init__cCs|j�t|�dS)z,
        Forward data to transport.
        N�rg�writeToChildr
�r�datarrrrO�szLocalWorkerTransport.writecCs|D]	}|j�t|�qdS)zP
        Emulate C{writeSequence} by iterating data in the C{sequence}.
        Nri)r�sequencerlrrr�
writeSequence�s�z"LocalWorkerTransport.writeSequencecCs|j��dS)z'
        Closes the transport.
        N)rg�loseConnection�rrrrro�sz#LocalWorkerTransport.loseConnectioncC�t�S�z:
        Return a L{LocalWorkerAddress} instance.
        �rerprrr�getHost��zLocalWorkerTransport.getHostcCrqrrrsrprrr�getPeer�ruzLocalWorkerTransport.getPeerN)
r&r'r(r)rrOrnrortrvrrrrrf�srfc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�LocalWorkeraX
    Local process worker protocol. This worker runs as a local process and
    communicates via stdin/out.

    @ivar _ampProtocol: The L{AMP} protocol instance used to communicate with
        the worker.

    @ivar _logDirectory: The directory where logs will reside.

    @ivar _logFile: The name of the main log file for tests output.
    cCs||_||_||_t�|_dSr)�_ampProtocol�
_logDirectory�_logFiler�endDeferred)r�ampProtocol�logDirectory�logFilerrrr�szLocalWorker.__init__cCs�|j�t|j��tj�|j�st�|j�t	tj�
|jd�d�|_t	tj�
|jd�d�|_t	tj�
|j|j
�dddd�|_|j�|j�|j}|jjtj|d�}|�d	d
��dS)zL
        When connection is made, create the AMP protocol instance.
        zout.log�wbzerr.log�wzutf-8�strict)�encoding�errors)r$cSsdSrr)�xrrr�<lambda>sz,LocalWorker.connectionMade.<locals>.<lambda>N)rx�makeConnectionrfrhr"�path�existsry�makedirs�open�join�_outLog�_errLogrz�_testLogr]rXr
r,�
addErrback)rr}r[rrr�connectionMade�s�zLocalWorker.connectionMadecCs"|j��|j��|j��dS)zk
        On connection lost, close the log files that we're managing for stdin
        and stdout.
        N)r��closer�r��rrGrrr�connectionLosts

zLocalWorker.connectionLostcCs&|�|�|j�|�|j�|�dS)z�
        When the process closes, call C{connectionLost} for cleanup purposes
        and forward the information to the C{_ampProtocol}.
        N)r�rxr{�callbackr�rrr�processEndeds
zLocalWorker.processEndedcC�|j�|�dS)z8
        Send data received from stdout to log.
        N)r�rOrkrrr�outReceived(szLocalWorker.outReceivedcCr�)z*
        Write error data to log.
        N)r�rOrkrrr�errReceived/szLocalWorker.errReceivedcCs*|tkr|j�|�dSt�|||�dS)zT
        Handle data received on the specific pipe for the C{_ampProtocol}.
        N)rrx�dataReceivedr�childDataReceived)r�childFDrlrrrr�5szLocalWorker.childDataReceivedN)r&r'r(r)rr�r�r�r�r�r�rrrrrw�s		rw)"r)r"�zope.interfacer�twisted.internet.deferr�twisted.internet.interfacesrr�twisted.internet.protocolr�twisted.protocols.ampr�twisted.python.failurer�twisted.python.reflectr	�twisted.trial._distr
rrr
�"twisted.trial._dist.workerreporterr�twisted.trial.runnerrr�twisted.trial.unittestrrr-rerfrwrrrr�<module>s( w)

Anon7 - 2022
AnonSec Team