Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/scripts/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�b�R�@slddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZddlmZddlmZddlmZmZmZd	d	d
d
ddd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z dej!fde fd�Z"dd�Z#Gdd�d�Z$Gd d!�d!e$ej%ej&�Z%d"d#�Z'd$d%�Z(d&d'�Z)d(d)�Z*Gd*d+�d+e+�Z,d,d-�Z-d.d/�Z.dS)0�N)�plugin)�app)�defer)�failure�reflect�usage)�FilePath)�namedModule)�itrial�reporter�runner�default�brief�verbose)�plainr
�emacsr�cgitbrcCs�d}|�|�t|�}|�|�}|dks|dkrt|�d���|||��d�}i}|D]+}t|���dkr7q,|�d�}t|�dkrKt|�d|����|d	��||d��<q,|S)
a

    Accepts a single line in Emacs local variable declaration format and
    returns a dict of all the variables {name: value}.
    Raises ValueError if 'line' is in the wrong format.

    See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
    z-*-���z' not a valid local variable declaration�;r�:�z contains invalid declaration �)�find�len�rfind�
ValueError�split�strip)�line�paren�start�end�items�	localVars�itemr�r%�7/usr/lib/python3/dist-packages/twisted/scripts/trial.py�_parseLocalVariables#s

r'c	Csft|��}|��|��g}Wd�n1swY|D]}zt|�WSty0YqwiS)z�
    Accepts a filename and attempts to load the Emacs variable declarations
    from that file, simulating what Emacs does.

    See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
    N)�open�readliner'r)�filename�f�linesrr%r%r&�loadLocalVariables<s
��r-cCs&t|��dd�}|durgS|�d�S)Nztest-case-name�,)r-�getr)r*�testCaseVarr%r%r&�getTestModulesMs
r1cCs*tj�|�}|�d�otj�|�ddkS)z�
    Returns true if 'filename' looks like a file containing unit tests.
    False otherwise.  Doesn't care whether filename exists.
    �test_rz.py)�os�path�basename�
startswith�splitext)r*r5r%r%r&�
isTestFileTsr8cCst�dd�t�tj�D��S)NcSsg|]}|j�qSr%)�longOpt)�.0�pr%r%r&�
<listcomp>^sz#_reporterAction.<locals>.<listcomp>)r�CompleteListr�
getPluginsr
�	IReporterr%r%r%r&�_reporterAction]sr@c	Csbt|dd�}|durt||�}t|dd�}|dur|jSzt�|�dWSttfy0YdSw)aH
    Try to find the source line of the given test thing.

    @param testThing: the test item to attempt to inspect
    @type testThing: an L{TestCase}, test method, or module, though only the
        former two have a chance to succeed
    @rtype: int
    @return: the starting source line, or -1 if one couldn't be found
    �_testMethodNameN�__code__rr)�getattr�co_firstlineno�inspect�getsourcelines�OSError�	TypeError)�	testThing�method�coder%r%r&�_maybeFindSourceLineas
�rLzCalphabetical order for test methods, arbitrary order for test caseszDattempt to run test cases and methods in the order they were defined)�alphabetical�toptobottomcCs,|tvrt�dd�dd�tD��f��|S)ai
    Check that the given order is a known test running order.

    Does nothing else, since looking up the appropriate callable to sort the
    tests should be done when it actually will be used, as the default argument
    will not be coerced by this function.

    @param order: one of the known orders in C{_runOrders}
    @return: the order unmodified
    z9--order must be one of: %s. See --help-orders for detailsz, css�|]}t|�VqdS�N)�repr)r:�orderr%r%r&�	<genexpr>�s�z&_checkKnownRunOrder.<locals>.<genexpr>)�
_runOrdersr�
UsageError�join)rQr%r%r&�_checkKnownRunOrder�s��rVc	@s0eZdZdZdZddggd�gd�gd�gd�gd	�gd
�gd�gZdd
ddeggd�gd�gd�gZej	e�
e�eej
dd�ejdd�d�ej
dddd�gd�ZejZdZdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Z d6d7�Z!d8d9�Z"d:d;�Z#dS)<�
_BasicOptionszC
    Basic options shared between trial and its local workers.
    zutrial loads and executes a suite of unit tests, obtained from modules, packages and files listed on the command line.�help�h)�
no-recurse�NzDon't recurse into packages)zhelp-ordersNz%Help on available test running orders)zhelp-reportersNz,Help on available output plugins (reporters))�rterrors�ez;realtime errors, print out tracebacks as soon as they occur)�unclean-warningsNz'Turn dirty reactor errors into warnings)�force-gcNz<Have Trial run gc.collect() before and after each test case.)�	exitfirst�xzSExit after the first non-successful result (cannot be specified along with --jobs).rQ�oNzRSpecify what order to run test cases and methods. See --help-orders for more info.)�random�zNz2Run tests in random order using the specified seed)�temp-directoryN�_trial_tempz+Path to use as working directory for tests.)rNrzKThe reporter to use for this test run.  See --help-reporters for more info.�
log file name)�descrzrandom seed)rQr�logfilercz*.pyz/file | module | package | TestCase | testMethodT)rh�repeat)�
optActions�extraActionscCsg|d<tj�|�dS�N�tests)r�Options�__init__��selfr%r%r&rp�sz_BasicOptions.__init__cCsBt�tjd�}|�d�rd�tj�tj	�|�
dd��}d�|�S)Nrz	.__main__z{} -m {}�zD{} [options] [[file|package|module|TestCase|testmethod]...]
        )r�filenameToModuleName�sys�argv�endswith�formatr3r4r5�
executable�replace)rr�executableNamer%r%r&�getSynopsis�s

���z_BasicOptions.getSynopsiscCs,d}t|d��|�}td|j�d��|S)zx
        Return a L{FilePath} representing the directory into which coverage
        results should be written.
        �coveragerezSetting coverage directory to �.)r�child�printr4)rr�coverdir�resultr%r%r&r��sz_BasicOptions.coverdircCs2ddl}|jddd�|_t�|jj�d|d<dS)z�
        Generate coverage information in the coverage file in the
        directory specified by the temp-directory option.
        rNr)�count�traceTr})r��Trace�tracerru�settrace�globaltrace)rrr�r%r%r&�opt_coveragesz_BasicOptions.opt_coveragecCs`tj�|�stj�d|�d��dStj�|�}t|�r%|d�|�dS|d�	t
|��dS)zG
        Filename to grep for test cases (-*- test-case-name).
        zFile z doesn't exist
Nrn)r3r4�isfileru�stderr�write�abspathr8�append�extendr1)rrr*r%r%r&�opt_testmodulesz_BasicOptions.opt_testmodulecCsddlm}t�|�dS)z�
        Print an insanely verbose log of everything that happens.  Useful
        when debugging freezes or locks in complex code.
        r)�spewerN)�twisted.python.utilr�rur�)rrr�r%r%r&�opt_spew3sz_BasicOptions.opt_spewcCsBd}t|�tt���D]
\}\}}td|d|�qt�d�dS)Nz�Trial can attempt to run test cases and their methods in a few different orders. You can select any of the following options using --order=<foo>.
�   �	r)r��sortedrSr"ru�exit)rr�synopsis�name�description�_r%r%r&�opt_help_orders<s�z_BasicOptions.opt_help_orderscCs>d}t|�t�tj�D]}td|jd|j�qt�d�dS)Nz�Trial's output can be customized using plugins called Reporters. You can
select any of the following reporters using --reporter=<foo>
r�r�r)	r�rr>r
r?r9r�rur�)rrr�r;r%r%r&�opt_help_reportersHs�z _BasicOptions.opt_help_reporterscCsd|d<t��dS)z/
        Disable the garbage collector
        T�	disablegcN)�gc�disablerqr%r%r&�
opt_disablegcSsz_BasicOptions.opt_disablegccCs,z	t||d<WdStyt�d��w)z�
        Specify the format to display tracebacks with. Valid formats are
        'plain', 'emacs', and 'cgitb' which uses the nicely verbose stdlib
        cgitb.text function
        �tbformatz.tbformat must be 'plain', 'emacs', or 'cgitb'.N)�TBFORMAT_MAP�KeyErrorrrT)rr�optr%r%r&�opt_tbformatZs

�z_BasicOptions.opt_tbformatc	Cs@z	t�t|��Wnttfyt�d��wt|�|d<dS)z-
        see sys.setrecursionlimit()
        z-argument to recursionlimit must be an integer�recursionlimitN)ru�setrecursionlimit�intrHrrrT)rr�argr%r%r&�opt_recursionlimites
�z _BasicOptions.opt_recursionlimitcCshzt|�|d<Wntyt�d��w|ddkr t�d��|ddkr2tt��d�|d<dSdS)Nrcz/Argument to --random must be a positive integerr�d)r�rrrT�time)rr�optionr%r%r&�
opt_randomps
���z_BasicOptions.opt_randomcCsD||d<|�d�D]}|tjvrtjd|ftd�dtj|<q	dS)zP
        Fake the lack of the specified modules, separated with commas.
        �without-moduler.z/Module '%s' already imported, disabling anyway.)�categoryN)rru�modules�warnings�warn�RuntimeWarning)rrr��moduler%r%r&�opt_without_module}s
��z _BasicOptions.opt_without_modulecGs|d�|�dSrm)r�)rr�argsr%r%r&�	parseArgs�sz_BasicOptions.parseArgscCsFt�tj�D]}|j�d|j��}|j|krt�|�Sqt	�
d��)Nr~zVOnly pass names of Reporter plugins to --reporter. See --help-reporters for more info.)rr>r
r?r��klassr9r�namedAnyrrT)rrr�r;�qualr%r%r&�_loadReporterByName�s
��z!_BasicOptions._loadReporterByNamecCsL|�|d�|d<d|vrd|d<|ddur"|ddur$t�d��dSdS)Nrr�r
rQrcz-You can't specify --random when using --order)r�rrTrqr%r%r&�postOptions�s
�z_BasicOptions.postOptions)$�__name__�
__module__�__qualname__�__doc__�longdesc�optFlagsrV�
optParametersr�Completionsr=rSr@�
CompleteFiles�	Completer�compDatar�TreeReporter�fallbackReporterr�rpr|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r%r%r%r&rW�sl����

����	

rWc@s�eZdZdZgd�gd�gd�gd�gd�gd�gZgd�gd	�gd
�gZeje�gd��e	d�d
�Z
gd�Zgd�Ze
jZdZdZdd�Zdd�Zdd�ZdS)roa�
    Options to the trial command line tool.

    @ivar _workerFlags: List of flags which are accepted by trial distributed
        workers. This is used by C{_getWorkerArguments} to build the command
        line arguments.
    @type _workerFlags: C{list}

    @ivar _workerParameters: List of parameter which are accepted by trial
        distributed workers. This is used by C{_getWorkerArguments} to build
        the command line arguments.
    @type _workerParameters: C{list}
    )�debug�bziRun tests in a debugger. If that debugger is pdb, will load '.pdbrc' from current directory if it exists.)�debug-stacktraces�Bz2Report Deferred creation and callback stack traces)�nopmNzFdon't automatically jump into debugger for postmorteming of exceptions)�dry-run�nzdo everything but run the tests)�profileNz#Run tests under the Python profiler)�
until-failure�uzRepeat test until it fails)�debuggerN�pdbzBthe fully qualified name of a debugger to use if --debug is passed)ri�lztest.logrg)�jobs�jNzNumber of local workers to run)rrr)r�r)rk)r�r_r})r��reactorr�NcCsHzt|�}Wntyt�d|��w|dkrt�d��||d<dS)zN
        Number of local workers to run, a strictly positive integer.
        z,Expecting integer argument to jobs, got '%s'rz4Argument to jobs must be a strictly positive integerr�N)r�rrrT)rr�numberr%r%r&�opt_jobs�s���zOptions.opt_jobscCspg}|jD]}|�|�dur||r|�d|���q|jD]}|�|�dur5|�d|��t||�g�q|S)zJ
        Return a list of options to pass to distributed workers.
        Nz--)�_workerFlagsr/r��_workerParametersr��str)rrr�r�r%r%r&�_getWorkerArguments�s
�
�zOptions._getWorkerArgumentscCsbt�|�|drgd�}|D]
}||rt�d|��q|dr/|ds*t�d��dt_dSdS)Nr�)r�r�r�r`z(You can't specify --%s when using --jobsr�r�z+You must specify --debug when using --nopm F)rWr�rrTr�DO_POST_MORTEM)rr�	conflictsr�r%r%r&r��s
��

�zOptions.postOptions)r�r�r�r�r�r�rr�r=r@r�r�r�rr�r��extrar�r�r�r�r%r%r%r&ro�s4����rocCs2|drt��|ds|drt�d�dSdS)Nr�r�T)r�startDebugModer�setDebugging)�configr%r%r&�_initialDebugSetups
�r�cCs$t|�}|d}|j|d|d�S)NrZrn)�recurse)�
_getLoader�loadByNames)r��loaderr�r%r%r&�	_getSuites
r�csxt��}|dr#t�����|d��fdd�|_td|d�n|dr2t|d\}}||_|ds:tj|_	|S)Nrccs���SrO)rc)ra��randomerr%r&�<lambda>!sz_getLoader.<locals>.<lambda>z$Running tests shuffled with seed %d
rQr�)
r�
TestLoaderrc�Random�seed�sorterr�rS�DestructiveTestSuite�suiteFactory)r�r�r�r�r%r�r&r�sr�c	Cs�t��}ztd�Wn
tytd�YnwdD]2}tj�|�rLzt|�}Wn	t	y1Yqw|�|j
�|���Wd�n1sGwYq|S)zR
    Wrap an instance of C{pdb.Pdb} with readline support and load any .rcs.

    r)zreadline module not available)z.pdbrc�pdbrcN)
r��Pdbr	�ImportErrorr�r3r4�existsr(rG�rcLinesr��	readlines)�dbgr4�rcFiler%r%r&�_wrappedPdb+s$����r�c@seZdZdZdS)�_DebuggerNotFoundzk
    A debugger import failed.

    Used to allow translating these errors into usage error messages.

    N)r�r�r�r�r%r%r%r&rBsrcCs
tj}|d|d|d|d|d|dd�}|dr#tjj|d	<n[|d
r<ddlm}|}|d
|d
<|��|d<nB|drltjj|d	<|d}|dkrgz	t�|�|d<Wntj	yft
|�d���wt�|d<|d|d<|d|d<|d|d<|di|��S)z�
    Return a trial runner class set up with the parameters extracted from
    C{config}.

    @return: A trial runner instance.
    @rtype: L{runner.TrialRunner} or C{DistTrialRunner} depending on the
        configuration.
    rr�r\r^rire)�reporterFactory�tracebackFormat�realTimeErrors�uncleanWarningsri�workingDirectoryr��moder�r)�DistTrialRunner�workerNumber�workerArgumentsr�r�r�z debugger could not be found.r`�	exitFirstr�r_�forceGarbageCollectionNr%)r�TrialRunner�DRY_RUN�twisted.trial._dist.disttrialrr��DEBUGrr��ModuleNotFoundrr�)r��clsr�rr�r%r%r&�_makeRunnerKs>	���
rc
Csttj�dkr
tj�d�t�}z|��Wntjy/}zttjd�d|����d}~wwt	|�zt
|�}WntyT}zttjd�dt|�����d}~wwt
|�}|drc|�|�}n|�|�}|jr�t�d�|j��}|jdd|��jd�t�|���dS)Nrz--helprz: r�F)�show_missing�summaryr�)rrurvr�ro�parseOptionsr�error�
SystemExitr�rrr�r��runUntilFailure�runr�r��results�
write_resultsr�r4r��
wasSuccessful)r��ue�trialRunnerr]�suite�test_resultrr%r%r&r{s6����


�r)/r�rEr3r�rcrur�r��twistedr�twisted.applicationr�twisted.internetr�twisted.pythonrrr�twisted.python.filepathr�twisted.python.reflectr	�
twisted.trialr
rrr�r'r-r1r8r@rLr�rSrVrWro�ReactorSelectionMixinr�r�r�r��	Exceptionrrrr%r%r%r&�<module>s^�
	!���k	0

Spamworldpro Mini