%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/selector.cpython-37.pyc

B

9�`#�@s�dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZe�
e�ZdddgZejjZejjZejjZejjZejjZejjZGdd�de�ZeZ Gd	d�de�Z!dS)
z�
Test Selection
--------------

Test selection is handled by a Selector. The test loader calls the
appropriate selector method for each object it encounters that it
thinks may be a test.
�N)�Config)�split_test_name�src�getfilename�
getpackage�	ispackage�
is_executable�Selector�defaultSelector�TestAddressc@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)r	z�Core test selector. Examines test candidates and determines whether,
    given the specified configuration, the test candidate should be selected
    as a test.
    cCs|dkrt�}|�|�dS)N)r�	configure)�self�config�r�>/opt/alt/python37/lib/python3.7/site-packages/nose/selector.py�__init__"szSelector.__init__cCs2||_|j|_|j|_|j|_|j|_|j|_dS)N)r�exclude�ignoreFiles�include�pluginsZ	testMatch�match)r
rrrrr'szSelector.configurecsX|j���s0|joVdd��fdd�|jD�D�oV|jpVdd��fdd�|jD�D�S)z�Does the name match my requirements?

        To match, a name must match config.testMatch OR config.include
        and it must not match config.exclude
        cSsg|]}|r|�qSrr)�.0�_frrr�
<listcomp>7sz$Selector.matches.<locals>.<listcomp>csg|]}|����qSr)�search)rZinc)�namerrr7scSsg|]}|r|�qSrr)rrrrrr9scsg|]}|����qSr)r)r�exc)rrrr9s)rrrr)r
rr)rr�matches/s
zSelector.matchescCsxt|dd�}|dk	r|}n&|j�d�o>t|tj�p>|�|j�}|j�|�}|dk	rft	�
d||�|}t	�
d||�|S)z�Is the class a wanted test class?

        A class must be a unittest.TestCase subclass, or match test name
        requirements. Classes that start with _ are always excluded.
        �__test__N�_z$Plugin setting selection of %s to %szwantClass %s? %s)�getattr�__name__�
startswith�
issubclass�unittestZTestCaserr�	wantClass�log�debug)r
�cls�declared�wanted�
plug_wantsrrrr%<szSelector.wantClasscs�t|��t|�r:|jp6dd��fdd�|jD�D�}n|���pV|jjoV�|jjk}|j�|�}|dk	r~t�	d||�|}t�	d||�|S)z�Is the directory a wanted test directory?

        All package directories match, so long as they do not match exclude. 
        All other directories must match test requirements.
        cSsg|]}|r|�qSrr)rrrrrrZsz*Selector.wantDirectory.<locals>.<listcomp>csg|]}|����qSr)r)rr)�tailrrrZsNz$Plugin setting selection of %s to %szwantDirectory %s? %s)
�op_basenamerrrrZsrcDirsr�
wantDirectoryr&r')r
�dirnamer*r+r)r,rr.Qs"
zSelector.wantDirectorycs�t|���fdd�|jD�}|r0t�d��dS|jjsPt|�rPt�d|�dSt��\}}|dk}|op|�	��}|j
�|�}|dk	r�t�d||�|}t�d	||�|S)
aIs the file a wanted test file?

        The file must be a python source file and match testMatch or
        include, and not match exclude. Files that match ignore are *never*
        wanted, regardless of plugin, testMatch, include or exclude settings.
        csg|]}|���r|�qSr)r)rZignore_this)�baserrrqsz%Selector.wantFile.<locals>.<listcomp>z'%s matches ignoreFiles pattern; skippedFz%s is executable; skippedz.pyNzplugin setting want %s to %szwantFile %s? %s)r-rr&r'rZ
includeExer�info�op_splitextrr�wantFile)r
�fileZignore_matchesZdummyZextZpysrcr*r+r)r0rr3gs$	zSelector.wantFilecCs�yt|d�r|j}n|j}Wntk
r0dSXt|dd�}|dk	rL|}n|�d�o`|�|�}|j�|�}|dk	rz|}t	�
d||�|S)z)Is the function a test function?
        �compat_func_nameFrNrzwantFunction %s? %s)�hasattrr5r!�AttributeErrorr r"rr�wantFunctionr&r')r
Zfunction�funcnamer)r*r+rrrr8�s

zSelector.wantFunctioncCs|y
|j}Wntk
rdSX|�d�r.dSt|dd�}|dk	rH|}n
|�|�}|j�|�}|dk	rj|}t�d||�|S)z%Is the method a test method?
        FrrNzwantMethod %s? %s)	r!r7r"r rr�
wantMethodr&r')r
�methodZmethod_namer)r*r+rrrr:�s


zSelector.wantMethodcCsdt|dd�}|dk	r|}n |�|j�d�d�p8|jdk}|j�|�}|dk	rR|}t�d||�|S)z�Is the module a test module?

        The tail of the module name must match test requirements. One exception:
        we always want __main__.
        rN�.����__main__zwantModule %s? %s)r rr!�splitr�
wantModuler&r')r
�moduler)r*r+rrrr@�s
zSelector.wantModuleN)
r!�
__module__�__qualname__�__doc__rrrr%r.r3r8r:r@rrrrr	s
c@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)ra�A test address represents a user's request to run a particular
    test. The user may specify a filename or module (or neither),
    and/or a callable (a class, function, or method). The naming
    format for test addresses is:

    filename_or_module:callable

    Filenames that are not absolute will be made absolute relative to
    the working dir.

    The filename or module part will be considered a module name if it
    doesn't look like a file, that is, if it doesn't exist on the file
    system and it doesn't contain any directory separators and it
    doesn't end in .py.

    Callables may be a class name, function name, method name, or
    class.method specification.
    NcCs�|dkrt��}||_||_t|�\|_|_|_t�	d||j|j|j�|jdkrl|jdk	rlt
|j|j�|_|jr�t|j�|_t|j�s�t
t||j��|_|jdkr�t|j�|_t�	d||j|j|j�dS)Nz4Test name %s resolved to file %s, module %s, call %sz;Final resolution of test name %s: file %s module %s call %s)�os�getcwdr�
workingDirr�filenamerA�callr&r'rr�op_isabs�
op_abspath�op_joinr)r
rrGrrrr�s(



zTestAddress.__init__cCs|j|j|jfS)N)rHrArI)r
rrr�totuple�szTestAddress.totuplecCs|jS)N)r)r
rrr�__str__�szTestAddress.__str__cCsd|j|j|j|jfS)Nz%s: (%s, %s, %s))rrHrArI)r
rrr�__repr__�s
zTestAddress.__repr__)N)r!rBrCrDrrMrNrOrrrrr�s

)"rDZloggingrEr$Znose.configrZ	nose.utilrrrrrrZ	getLoggerr!r&�__all__�path�joinrL�basenamer-�existsZ	op_exists�splitextr2�isabsrJ�abspathrK�objectr	r
rrrrr�<module>s" 

'

Zerion Mini Shell 1.0