Ñò Æ^mGc@sþdZddkZddkZddkZddklZddklZlZl Z l Z l Z ei e ƒZdddgZeiiZeiiZeiiZeiiZeiiZeiiZdefd„ƒYZeZdefd „ƒ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_nametsrct getfilenamet getpackaget ispackagetSelectortdefaultSelectort TestAddresscBs_eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s¥Core test selector. Examines test candidates and determines whether, given the specified configuration, the test candidate should be selected as a test. cCs+|djo tƒ}n|i|ƒdS(N(tNoneRt configure(tselftconfig((s1/usr/lib/python2.6/site-packages/nose/selector.pyt__init__"s  cCsI||_|i|_|i|_|i|_|i|_|i|_dS(N(R texcludet ignoreFilestincludetpluginst testMatchtmatch(R R ((s1/usr/lib/python2.6/site-packages/nose/selector.pyR 's      c Cs”|ii|ƒpA|iowtdg}|iD]}||i|ƒq1~ƒo@|i p5tdg}|iD]}||i|ƒqs~ƒ 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 tnamet_[1]tinct_[2]texc((s1/usr/lib/python2.6/site-packages/nose/selector.pytmatches/s 1 cCsµt|ddƒ}|dj o |}n:|iidƒ o#t|tiƒp|i|iƒ}|ii |ƒ}|dj ot i d||ƒ|}nt i d||ƒ|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.6/site-packages/nose/selector.pyR$>s    cCsát|ƒ}t|ƒoF|i p5tdg}|iD]}||i|ƒq8~ƒ }n0|i|ƒp|iio||iij}|i i |ƒ}|dj ot i d||ƒ|}nt i 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( t op_basenameRRRR RRR tsrcDirsRt wantDirectoryR%R&(R tdirnamettailRRR)R*((s1/usr/lib/python2.6/site-packages/nose/selector.pyR-Ss   5     c Cs t|ƒ}g}|iD]!}|i|ƒo ||qq~}|otid|ƒtS|ii o+ti |ti ƒoti d|ƒtSt |ƒ\}}|dj}|o |i |ƒ} |ii|ƒ} | dj otid|| ƒ| } ntid|| ƒ| 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 includeExetostaccesstX_OKtinfot op_splitextRRtwantFileR ( R tfiletbaseRt ignore_thistignore_matchestdummytexttpysrcR)R*((s1/usr/lib/python2.6/site-packages/nose/selector.pyR7ks& $ $   cCsÊy*t|dƒo |i}n |i}Wntj otSXt|ddƒ}|dj o |}n!|idƒ o |i|ƒ}|i i |ƒ}|dj o |}nt i d||ƒ|S(s)Is the function a test function? tcompat_func_nameRRswantFunction %s? %sN( thasattrR?RtAttributeErrorR0RR R RRt wantFunctionR%R&(R tfunctiontfuncnameR(R)R*((s1/usr/lib/python2.6/site-packages/nose/selector.pyRB‰s       cCs±y |i}Wntj otSX|idƒotSt|ddƒ}|dj o |}n|i|ƒ}|ii|ƒ}|dj o |}nt i d||ƒ|S(s%Is the method a test method? RRswantMethod %s? %sN( RRAR0R RR RRt wantMethodR%R&(R tmethodt method_nameR(R)R*((s1/usr/lib/python2.6/site-packages/nose/selector.pyREŸs     cCs˜t|ddƒ}|dj o |}n0|i|iidƒdƒp |idj}|ii|ƒ}|dj o |}ntid||ƒ|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.6/site-packages/nose/selector.pyRKµs     ( Rt __module__t__doc__R R RR$R-R7RBRERK(((s1/usr/lib/python2.6/site-packages/nose/selector.pyRs        cBs,eZdZdd„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. cCsJ|djotiƒ}n||_||_t|ƒ\|_|_|_t i d||i|i|iƒ|idjo0|idj ot |i|iƒ|_q¯n|iokt |iƒ|_t |iƒptt||iƒƒ|_n|idjot|iƒ|_q$nt i d||i|i|iƒ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 R2tgetcwdRt workingDirRtfilenameRLtcallR%R&RRtop_isabst op_abspathtop_joinR(R RRP((s1/usr/lib/python2.6/site-packages/nose/selector.pyR Ýs(       cCs|iS(N(R(R ((s1/usr/lib/python2.6/site-packages/nose/selector.pyt__str__óscCs d|i|i|i|ifS(Ns%s: (%s, %s, %s)(RRQRLRR(R ((s1/usr/lib/python2.6/site-packages/nose/selector.pyt__repr__ösN(RRMRNR R RVRW(((s1/usr/lib/python2.6/site-packages/nose/selector.pyRÊs  (!RNtloggingR2R"t nose.configRt nose.utilRRRRRt getLoggerRR%t__all__tpathtjoinRUtbasenameR+texistst op_existstsplitextR6tisabsRStabspathRTtobjectRRR(((s1/usr/lib/python2.6/site-packages/nose/selector.pyts    (      ª