Current File : //lib/python2.7/site-packages/nose/selector.pyc
�
d�Uc@sdZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZej
e�ZdddgZejjZejjZejjZejjZejjZejjZdefd��YZeZ defd	��YZ!dS(
s�
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.
i����N(tConfig(tsplit_test_nametsrctgetfilenamet
getpackaget	ispackaget
is_executabletSelectortdefaultSelectortTestAddresscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s�Core test selector. Examines test candidates and determines whether,
    given the specified configuration, the test candidate should be selected
    as a test.
    cCs)|dkrt�}n|j|�dS(N(tNoneRt	configure(tselftconfig((s1/usr/lib/python2.7/site-packages/nose/selector.pyt__init__"scCsI||_|j|_|j|_|j|_|j|_|j|_dS(N(R
texcludetignoreFilestincludetpluginst	testMatchtmatch(RR
((s1/usr/lib/python2.7/site-packages/nose/selector.pyR's	c
Cs�|jj|�sI|jotdg|jD]}|j|�^q+�o|jptdg|jD]}|j|�^qc�S(s�Does the name match my requirements?

        To match, a name must match config.testMatch OR config.include
        and it must not match config.exclude
        N(RtsearchRtfilterR
R(Rtnametinctexc((s1/usr/lib/python2.7/site-packages/nose/selector.pytmatches/s	(
cCs�t|dd�}|dk	r'|}n7|jjd�o[t|tj�p[|j|j�}|jj	|�}|dk	r�t
jd||�|}nt
jd||�|S(s�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.
        t__test__t_s$Plugin setting selection of %s to %sswantClass %s? %sN(tgetattrR
t__name__t
startswitht
issubclasstunittesttTestCaseRRt	wantClasstlogtdebug(Rtclstdeclaredtwantedt
plug_wants((s1/usr/lib/python2.7/site-packages/nose/selector.pyR#>s		cCs�t|�}t|�rT|jpNtdg|jD]}|j|�^q2�}n-|j|�p~|jjo~||jjk}|j	j
|�}|dk	r�tjd||�|}ntjd||�|S(s�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.
        s$Plugin setting selection of %s to %sswantDirectory %s? %sN(
top_basenameRRRR
RRR
tsrcDirsRt
wantDirectoryR$R%(RtdirnamettailRR(R)((s1/usr/lib/python2.7/site-packages/nose/selector.pyR,Ss
,	
	c
Cst|�}g|jD]}|j|�r|^q}|rQtjd|�tS|jjr~t|�r~tj	d|�tSt
|�\}}|dk}|o�|j|�}|jj
|�}	|	dk	r�tjd||	�|	}ntjd||�|S(sIs 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.
        s'%s matches ignoreFiles pattern; skippeds%s is executable; skippeds.pysplugin setting want %s to %sswantFile %s? %sN(R*RRR$R%tFalseR
t
includeExeRtinfotop_splitextRRtwantFileR
(
Rtfiletbasetignore_thistignore_matchestdummytexttpysrcR(R)((s1/usr/lib/python2.7/site-packages/nose/selector.pyR3ks&			cCs�y(t|d�r|j}n	|j}Wntk
r<tSXt|dd�}|dk	rd|}n|jd�o�|j|�}|j	j
|�}|dk	r�|}ntjd||�|S(s)Is the function a test function?
        tcompat_func_nameRRswantFunction %s? %sN(
thasattrR;RtAttributeErrorR/RR
RRRtwantFunctionR$R%(RtfunctiontfuncnameR'R(R)((s1/usr/lib/python2.7/site-packages/nose/selector.pyR>�s

		cCs�y
|j}Wntk
r!tSX|jd�r5tSt|dd�}|dk	r\|}n|j|�}|jj|�}|dk	r�|}nt	j
d||�|S(s%Is the method a test method?
        RRswantMethod %s? %sN(RR=R/RRR
RRt
wantMethodR$R%(Rtmethodtmethod_nameR'R(R)((s1/usr/lib/python2.7/site-packages/nose/selector.pyRA�s

		cCs�t|dd�}|dk	r'|}n.|j|jjd�d�pR|jdk}|jj|�}|dk	r||}ntjd||�|S(s�Is the module a test module?

        The tail of the module name must match test requirements. One exception:
        we always want __main__.
        Rt.i����t__main__swantModule %s? %sN(	RR
RRtsplitRt
wantModuleR$R%(RtmoduleR'R(R)((s1/usr/lib/python2.7/site-packages/nose/selector.pyRG�s		(Rt
__module__t__doc__RRRR#R,R3R>RARG(((s1/usr/lib/python2.7/site-packages/nose/selector.pyRs								cBs5eZdZdd�Zd�Zd�Zd�ZRS(s�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.
    cCs>|dkrtj�}n||_||_t|�\|_|_|_t	j
d||j|j|j�|jdkr�|jdk	r�t|j|j�|_q�n|jrt|j�|_t
|j�s�tt||j��|_n|jdkrt|j�|_qnt	j
d||j|j|j�dS(Ns4Test name %s resolved to file %s, module %s, call %ss;Final resolution of test name %s: file %s module %s call %s(R
tostgetcwdRt
workingDirRtfilenameRHtcallR$R%RRtop_isabst
op_abspathtop_joinR(RRRM((s1/usr/lib/python2.7/site-packages/nose/selector.pyR�s(					cCs|j|j|jfS(N(RNRHRO(R((s1/usr/lib/python2.7/site-packages/nose/selector.pyttotuple�scCs|jS(N(R(R((s1/usr/lib/python2.7/site-packages/nose/selector.pyt__str__�scCs d|j|j|j|jfS(Ns%s: (%s, %s, %s)(RRNRHRO(R((s1/usr/lib/python2.7/site-packages/nose/selector.pyt__repr__�sN(RRIRJR
RRSRTRU(((s1/usr/lib/python2.7/site-packages/nose/selector.pyR	�s
		("RJtloggingRKR!tnose.configRt	nose.utilRRRRRRt	getLoggerRR$t__all__tpathtjoinRRtbasenameR*texistst	op_existstsplitextR2tisabsRPtabspathRQtobjectRRR	(((s1/usr/lib/python2.7/site-packages/nose/selector.pyt<module>s .�