403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.217.162.18
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__/loader.cpython-37.pyc
B

.�Se�c�@s<dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZmZmZdd	lmZmZdd
lmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'ddlm(Z(m)Z)e�*e+�Z,ej-j.Z/ej-j0Z1ej-j2Z3ej-j4Z5ej-j6Z7d
dgZ8Gdd
�d
ej9�Z9e9Z:dS)z�
Test Loader
-----------

nose's test loader implements the same basic functionality as its
superclass, unittest.TestLoader, but extends it by more liberal
interpretations of what may be a test and how a test may be named.
�N)�
isfunction)�unbound_method�ismethod)�FunctionTestCase�MethodTestCase)�Failure)�Config)�Importer�add_path�remove_path)�defaultSelector�TestAddress)
�func_lineno�
getpackage�isclass�isgenerator�	ispackage�regex_last_key�resolve_name�transplant_func�transplant_class�test_address)�ContextSuiteFactory�ContextList�	LazySuite)�	sort_list�
cmp_to_key�
TestLoader�defaultTestLoadercs�eZdZdZdZdZdZdZdZd&dd�Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zd'dd�Zd(dd�Zd)dd�Z�fdd�Zdd�Zd*dd�Zd+d d!�Zd"d#�Zd$d%�Z�ZS),raATest loader that extends unittest.TestLoader to:

    * Load tests from test-like functions and classes that are not
      unittest.TestCase subclasses
    * Find and load test modules in a directory
    * Support tests that are generators
    * Support easy extensions of or changes to that behavior through plugins
    NcCs�|dkrt�}|dkr t|d�}|dkr.|j}|dkr@t|�}nt|�rP||�}||_||_tt|��|_||_	|j
r�t||�t|d�|_
tg�|_tj�|�dS)aInitialize a test loader.

        Parameters (all optional):

        * config: provide a `nose.config.Config`_ or other config class
          instance; if not provided a `nose.config.Config`_ with
          default values is used.
        * importer: provide an importer instance that implements
          `importFromPath`. If not provided, a
          `nose.importer.Importer`_ is used.
        * workingDir: the directory to which file and module names are
          relative. If not provided, assumed to be the current working
          directory.
        * selector: a selector class or instance. If a class is
          provided, it will be instantiated with one argument, the
          current config. If not provided, a `nose.selector.Selector`_
          is used.
        N)�config)rr	�
workingDirrrr�importer�op_normpath�
op_abspath�selector�addPathsr
r�
suiteClass�set�
_visitedPaths�unittestr�__init__)�selfrr!r r$�r,�</opt/alt/python37/lib/python3.7/site-packages/nose/loader.pyr*;s&



zTestLoader.__init__cCsf|jjrtj�||�S||jfdd�}tt|t|���}|sLt	|d�rLdg}|j
rbt|t|j
��|S)z_Override to select with selector, unless
        config.getTestCaseNamesCompat is True
        cSs6t||d�}t|�r t||�}nt|�s,dS|�|�S)NF)�getattrrrr�
wantMethod)�attr�cls�sel�itemr,r,r-�wantedlsz+TestLoader.getTestCaseNames.<locals>.wanted�runTest)
rZgetTestCaseNamesCompatr)r�getTestCaseNamesr$�list�filter�dir�hasattr�sortTestMethodsUsingrr)r+�
testCaseClassr4�casesr,r,r-r6eszTestLoader.getTestCaseNamescCs|dkrdS||jkS)NF)r()r+�pathr,r,r-�_haveVisited}szTestLoader._haveVisitedcCs|dk	r|j�|�dS)N)r(�add)r+r>r,r,r-�_addVisitedPath�szTestLoader._addVisitedPathc
	#s�t�d|��jj}|�|��jjr2t|�j�}t�|�}t	|t
�jj���x�|D]�}|�d�rfqVt
t||���t��}d}|r�d}�j���}n$t��}|r�|�d�r�qV�j���}t��}	|rV����sV����|�r|��|�d��r�j�dd�Vn����V|��qV|	�r4�j�dd�VqV����fdd	��VqVWg}
x|�|�D]}|
�|��q^Wy|
�r���|
�VWn<tt fk
�r��Yn"��t!t"�#��g�VYnX�jj�r�x|D]}t$|��q�W|�%|�d
S)z�Load tests from the directory at path. This is a generator
        -- each suite of tests from a module or other file is yielded
        and is expected to be executed before the next file is
        examined.
        zload from dir %s�.F�_z.pyT)�
discoveredcs
����S)N)�loadTestsFromDirr,)�
entry_pathr+r,r-�<lambda>��z-TestLoader.loadTestsFromDir.<locals>.<lambda>N)&�log�debugr�pluginsZbeforeDirectoryr%r
�os�listdirrrZ	testMatch�
startswithr#�op_join�	op_isfiler$ZwantFile�op_isdirZ
wantDirectoryrr?rAZ
beforeContext�endswith�loadTestsFromName�loadTestsFromFileZafterContextr&rE�append�KeyboardInterrupt�
SystemExitr�sys�exc_inforZafterDirectory)
r+r>rKZpaths_added�entries�entry�is_filer4�is_dir�
is_package�tests�test�pr,)rFr+r-rE�sd







zTestLoader.loadTestsFromDircCs�t�d|�yRdd�|jj�|�D�}|rBdd�|D�}|�|�St|d���td|��WnPt	t
fk
rx�Yn8t��}|�t
|d|d|d	|d
d
fd�g�Sd
S)z�Load tests from a non-module file. Default is to raise a
        ValueError; plugins may implement `loadTestsFromFile` to
        provide a list of tests loaded from the file.
        zLoad from non-module file %scSsg|]}|�qSr,r,)�.0r`r,r,r-�
<listcomp>�sz0TestLoader.loadTestsFromFile.<locals>.<listcomp>cSsg|]}|r|�qSr,r,)rbZ_fr,r,r-rc�s�rz!Unable to load tests from file %sr��N)�address)rIrJrrKrTr&�open�close�
ValueErrorrVrWrXrYr)r+�filenamer_�excr,r,r-rT�s"
zTestLoader.loadTestsFromFilecs$�|f��fdd�	}�j|�dd�S)z�Lazy-load tests from a generator function. The generator function
        may yield either:

        * a callable, or
        * a function name resolvable within the same module
        c	3s�yDx>|�D]4}��|�\}}t|�s.t||�}t|||d�Vq
WWnJtk
rZ�Yn6t��}t|d|d|dt��d�VYnXdS)N)�arg�
descriptorrrerf)rg)	�parseGeneratedTest�callabler.rrVrXrYrr)�g�mr`�	test_funcrmrl)�	generatorr+r,r-�generate�s
z3TestLoader.loadTestsFromGenerator.<locals>.generateF)�context�	can_split)r&)r+rt�modulerur,)rtr+r-�loadTestsFromGenerator�s
z!TestLoader.loadTestsFromGeneratorcsLt�d�r�jj}|�}�j}t||���|f��fdd�	}�j|�dd�S)z�Lazy-load tests from a generator method.

        This is more complicated than loading from a generator function,
        since a generator method may yield:

        * a function
        * a bound or unbound method, or
        * a method name
        Zim_classc	3s�y~xx|�D]n}��|�\}}t|�s4t|t||��}t|�rNt|||d�Vq
t|�rht|||d�Vq
ttd|�Vq
WWnJtk
r��Yn6t	�
�}t|d|d|dt��d�VYnXdS)N)rmrn)r`rmz%s is not a callable or methodrrerf)rg)rorprr.rrr�	TypeErrorrVrXrYr)rq�cr`rsrmrl)rtr+r,r-rus$z9TestLoader.loadTestsFromGeneratorMethod.<locals>.generateF)rvrw)r:�__self__�	__class__�__name__r.r&)r+rtr1�inst�methodrur,)rtr+r-�loadTestsFromGeneratorMethods

z'TestLoader.loadTestsFromGeneratorMethodFcs�t�d��g}g}g}|r(�j���r�xZt��D]N}t�|d�}t|�rb�j�|�r�|�|�q2t	|�r2�j�
|�r2|�|�q2Wt|dd��t|t���fdd�||D�}t�dg�}	|r�t
j�t
j�|��}x�|	D]~}
t�d|
�t�d	|t
j�|
�t
j�t
j�|
����jj�s@|�r@t
j�t
j�|
���|�r�t
j�|
�r�|���|
��q�Wx$�jj��|�D]}|�|��qrW��t|�d
��S)z�Load all tests from module and return a suite containing
        them. If the module has been discovered and is not test-like,
        the suite will be empty by default, though plugins may add
        their own tests.
        zLoad from module %sNcSs|jS)N)r~)�xr,r,r-rGJrHz0TestLoader.loadTestsFromModule.<locals>.<lambda>csg|]}�j|�d��qS))�parent)�makeTest)rb�t)rxr+r,r-rcLsz2TestLoader.loadTestsFromModule.<locals>.<listcomp>�__path__zLoad tests from module path %s?z!path: %s os.path.realpath(%s): %s)rv)rIrJr$Z
wantModuler9r.rZ	wantClassrUrZwantFunctionrrrLr>�normcase�realpathrZtraverseNamespacerN�isdir�extendrErK�loadTestsFromModuler&r)r+rxr>rDr_Ztest_classesZ
test_funcsr3r`Zmodule_paths�module_pathr,)rxr+r-r�4s>

zTestLoader.loadTestsFromModulec
s�t�d||��j}�jj�||�}|r0||�St|�jd�}|r�|jrN|j}��	||�\}}t
|�r�t|dd�|jkr�t
|t�s�t||j�}t||j�}t�d|||�t
|t�r�||g�S|t��||�g|d��S�n�|j�r�y\|jdkr�t|j�}nB�jj�|j|j�z�j�|j|j�}Wd�jj�|j|j�XWnNttfk
�r\�Yn4t��}	|t|	d|	d|	d	|��d
�g�S|j�r���|j|�S�j||j|d�Sn�|j�rb|j�|j�rt��}
|
dk�r|tt d|j�f|��d
�g�S�j|j|
d
�St!���r0t"��fdd��St#���rD��$��S|tt%d�|��d
�g�Sn|tt d||��d
�g�SdS)z�Load tests from the entity with the given name.

        The name may indicate a file, directory, module, or any object
        within a module. See `nose.util.split_test_name` for details on
        test name parsing.
        zload from %s (%s))r �
__module__Nzparent %s obj %s module %s)rvrrerf)rg)rDz>Can't find callable %s in file %s: file is not a python module)rxcs
����S)N)rEr,)r>r+r,r-rG�rHz.TestLoader.loadTestsFromName.<locals>.<lambda>zNo such file %szUnresolvable test name %s)&rIrJr&rrKrSr
r �call�resolverr.r~�
isinstancerrrr�rxrkrZbeforeImportr!ZimportFromPathZafterImportrVrWrXrYZtotupler�rrjrQrrPrT�OSError)r+�namerxrD�suite�
plug_tests�addrr��objrl�packager,)r>r+r-rShs�












zTestLoader.loadTestsFromNamecCsP|jj�||�}|r@|\}}|r@|�|�|�tj�|||�g�Stj�|||�S)zSLoad tests from all names, returning a suite containing all
        tests.
        )rrK�loadTestsFromNamesr&r)r)r+�namesrxZplug_resr�r,r,r-r��szTestLoader.loadTestsFromNamescshg}|jj}x|�|�D]}|�|�qW|s>tt|��|�S|�dd�tt|��|�D��|�|�S)z6Load tests from a unittest.TestCase subclass.
        cSsg|]}|�qSr,r,)rb�caser,r,r-rc�sz4TestLoader.loadTestsFromTestCase.<locals>.<listcomp>)rrK�loadTestsFromTestCaserU�superrr�r&)r+r<r=rKr�)r}r,r-r��sz TestLoader.loadTestsFromTestCasecsb��jfdd�}��fdd�t|t���D�}x �jj���D]}|�|�q>W��t|�d��S)a!Load tests from a test class that is *not* a unittest.TestCase
        subclass.

        In this case, we can't depend on the class's `__init__` taking method
        name arguments, so we have to compose a MethodTestCase for each
        method in the class that looks testlike.
        cSs6t||d�}t|�r t||�}nt|�s,dS|�|�S)NF)r.rrrr/)r0r1r2r3r,r,r-r4�sz1TestLoader.loadTestsFromTestClass.<locals>.wantedcsg|]}��t�|����qSr,)r�r.)rbr�)r1r+r,r-rcsz5TestLoader.loadTestsFromTestClass.<locals>.<listcomp>)rv)	r$r8r9rrK�loadTestsFromTestClassrUr&r)r+r1r4r=r`r,)r1r+r-r��sz!TestLoader.loadTestsFromTestClasscCs�y|�||�Sttfk
r&�Yn\t��}yt|�}Wn$tk
rV�Ynd}YnXt|d|d|d|d�SdS)Nrrerf)rg)�	_makeTestrVrWrXrYrr)r+r�r�rlr�r,r,r-r�s
zTestLoader.makeTestc	Cs�g}yt|�}Wn$tk
r&�Ynd}YnXx"|jj�||�D]}|�|�qHWy|rj|�|�SWnBttfk
r��Yn*t�	�}t
|d|d|d|d�St|�r�|r�t|t
j�s�t||�}t|tj�r�|St|��r0|�r|j|jk�rt||j�}t|tj��r$|�|�S|�|�Sn�t|��r�|dk�rJ|j}t|tj��rb||j�St|��rx|�||�St|�Sn\t|��r�|�r�|j|jk�r�t||j�}t|��r�|�||�St |�Snt
t!d||d�SdS)zVGiven a test object and its parent, return a test case
        or test suite.
        Nrrerf)rgzCan't make a test from %s)"rrVrrKr�rUr&rWrXrYrrr��types�
ModuleTyperr)�TestCaserr�r~r�
issubclassr�r�rr}rr�rrryrrz)r+r�r�r�r�r`rlr,r,r-r�sX











zTestLoader._makeTestcCsL|}|�d�}x|D]}|t||d�}}qW|dkrDttd|�}||fS)z#Resolve name within module
        rBNzNo such test %s)�splitr.rrj)r+r�rxr��parts�partr�r,r,r-r�Rs

zTestLoader.resolvecCsdt|t�s|t�}}nDt|�dkr6|dt�}}n&t|�dksFt�|d|dd�}}||fS)z�Given the yield value of a test generator, return a func and args.

        This is used in the two loadTestsFromGenerator* methods.

        rerN)r��tuple�len�AssertionError)r+r`rsrmr,r,r-ro^s
zTestLoader.parseGeneratedTest)NNNN)NF)NF)N)N)N)r~r��__qualname__�__doc__rr!r r$r&r*r6r?rArErTryr�r�rSr�r�r�r�r�r�ro�
__classcell__r,r,)r}r-r,s0
)M,
4
l


;);r��loggingrLrXr)r��inspectrZnose.pyversionrrZ	nose.caserrZnose.failurerZnose.configrZ
nose.importerr	r
rZ
nose.selectorrr
Z	nose.utilrrrrrrrrrrZ
nose.suiterrrrr�	getLoggerr~rIr>�normpathr"�abspathr#�joinrOr�rQ�isfilerP�__all__rrr,r,r,r-�<module>s80
E

Youez - 2016 - github.com/yon3zu
LinuXploit