ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ $TSc@sdZddlmZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z ddl mZmZddlmZddlmZdd lmZmZmZdd lmZmZdd lmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%dd l&m'Z'm(Z(m)Z)dd l m*Z*m+Z+ej,e-Z.ej/j0Z1ej/j2Z3ej/j4Z5ej/j6Z7ej/j8Z9ddgZ:dej;fdYZ;e;Z<dS(s 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. i(t generatorsN(t isfunction(tunbound_methodtismethod(tFunctionTestCasetMethodTestCase(tFailure(tConfig(tImportertadd_patht remove_path(tdefaultSelectort TestAddress( t func_linenot getpackagetisclasst isgeneratort ispackagetregex_last_keyt resolve_namettransplant_functtransplant_classt test_address(tContextSuiteFactoryt ContextListt LazySuite(t sort_listt cmp_to_keyt TestLoadertdefaultTestLoadercBseZdZdZdZdZdZdZdddddZ dZ dZ dZ dZ dZdZdZded Zded Zdd Zd Zd ZddZddZdZdZRS(sATest 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 cCs|dkrt}n|dkr6td|}n|dkrN|j}n|dkrit|}nt|r||}n||_||_tt ||_||_ |j rt ||nt d||_tg|_tjj|dS(sInitialize 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. tconfigN(tNoneRRt workingDirR RRtimportert op_normpatht op_abspathtselectortaddPathsR Rt suiteClasstsett _visitedPathstunittestRt__init__(tselfRR!R R$((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyR*;s&           cCs|jjrtjj||S||jd}t|t|}| rht|drhdg}n|j rt |t |j n|S(s_Override to select with selector, unless config.getTestCaseNamesCompat is True cSsMt||d}t|r0t||}nt|s@tS|j|S(N(tgetattrRRRRtFalset wantMethod(tattrtclstseltitem((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pytwantedls   trunTest( RtgetTestCaseNamesCompatR)RtgetTestCaseNamesR$tfiltertdirthasattrtsortTestMethodsUsingRR(R+t testCaseClassR3tcases((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyR6es   cCs|dkrtS||jkS(N(RR-R((R+tpath((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyt _haveVisited}s cCs#|dk r|jj|ndS(N(RR(tadd(R+R=((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyt_addVisitedPaths c #stjd|jj}|j|jjrJt|j}ntj|}t |t jj xa|D]Y}|j drqynt t||t}t}|rt}jj}n<t}|r|j drqynjj}nt} |ryj ryj|r|j|jdr}jdtVnjV|jq| rjdtVqjfdVqyqyWg} x$|j|D]} | j | qWy| rj| VnWn=t!t"fk r:n$jt#t$j%gVnXjjrx|D]} t&| qqWn|j'|dS(sLoad 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. sload from dir %st.t_s.pyt discoveredcs jS(N(tloadTestsFromDir((t entry_pathR+(s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyttN((tlogtdebugRtpluginstbeforeDirectoryR%R tostlistdirRRt testMatcht startswithR#top_joint op_isfileR-R$twantFiletop_isdirt wantDirectoryRR>R@t beforeContexttendswithtloadTestsFromNametTruetloadTestsFromFilet afterContextR&RDtappendtKeyboardInterruptt SystemExitRtsystexc_infoR tafterDirectory( R+R=RJt paths_addedtentriestentrytis_fileR3tis_dirt is_packagetteststtesttp((RER+s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRDsd          !  c Cstjd|yqg|jjj|D] }|^q)}|r]td|}|j|St|dj t d|Wn`t t fk rnGt j}|jt|d|d|dd|ddfgSXdS( sLoad 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. sLoad from non-module file %strs!Unable to load tests from file %siiitaddressN(RHRIRRJRYR7RR&topentcloset ValueErrorR\R]R^R_R(R+tfilenameRhRgtexc((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRYs"%  cs1|fd}j|ddtS(sLazy-load tests from a generator function. The generator function may yield either: * a callable, or * a function name resolvable within the same module c3sybx[|D]P}j|\}}t|sFt||}nt|d|d|Vq WWnOtk rxn<tj}t|d|d|ddtVnXdS(Ntargt descriptoriiiRk( tparseGeneratedTesttcallableR,RR\R^R_RR(tgtmRht test_funcRqRp(t generatorR+(s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pytgenerates   tcontextt can_split(R&R-(R+RxtmoduleRy((RxR+s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pytloadTestsFromGenerators csmtdrj}n|}j}t|||fd}j|ddtS(sLazy-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 tim_classc3syx|D]}j|\}}t|sOt|t||}nt|rut|d|d|Vq t|rt|d|d|Vq ttd|Vq WWnOtk rn<t j }t|d|d|ddt VnXdS( NRqRrRhs%s is not a callable or methodiiiRk( RsRtRR,RRRt TypeErrorR\R^R_R(RutcRhRwRqRp(RxR+(s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRys$     RzR{(R9R~t__name__R,R&R-(R+RxR0tinsttmethodRy((RxR+s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pytloadTestsFromGeneratorMethods    c stjdg}g}g}| s;jjrxtD]w}t|d}t|rjj|r|j |qqHt |rHjj |rH|j |qHqHWt |dt |t tfd||}ntdg} |r/tjj|}nx| D]} tjd| tjd|| tjj| jjs| stjj| j|r6tjj| r|jj| qq6q6Wx-jjj|D]}|j |qWjt|dS( sLoad 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. sLoad from module %scSs|jS(N(R(tx((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRFJRGcsj|dS(Ntparent(tmakeTest(tt(R|R+(s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRFLRGt__path__sLoad tests from module path %s?s!path: %s os.path.realpath(%s): %sRzN(RHRIR$t wantModuleR8R,RRt wantClassR[Rt wantFunctionRR tmapRLR=trealpathRttraverseNamespaceROtisdirtextendRDRJtloadTestsFromModuleR&R( R+R|R=RCRgt test_classest test_funcsR2Rht module_pathst module_path((R|R+s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyR4s<     c shtjd||j}jjj||}|rD||St|dj}|rD|jrt|j}nj ||\}}t |rt |dd|j krt|t rt||j }t ||j }ntjd|||t|tr||gS|tj||gd|Sn |jrby|jdkrqt|j}n[jjj|j|jzjj|j|j}Wdjjj|j|jXWnZttfk rnAtj} |t| d| d| d d |jgSX|jrFj|j|Sj||jd |Sn|jr>|j|jrt } | dkr|tt!d |jfd |jgSj|jd | St"rt#fdSt$rj%S|tt&dd |jgSn&|tt!d|d |jgSdS(sLoad 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. sload from %s (%s)R t __module__sparent %s obj %s module %sRzNiiiRkRCs>Can't find callable %s in file %s: file is not a python moduleR|cs jS(N(RD((R=R+(s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRFRGsNo such file %ssUnresolvable test name %s('RHRIR&RRJRWR R tcalltresolveRR,RRt isinstanceRRRRR|RoRt beforeImportR!timportFromPatht afterImportR\R]R^R_ttotupleRRRnRSRRQRYtOSError( R+tnameR|RCtsuitet plug_teststaddrRtobjRptpackage((R=R+s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRWes                       cCsw|jjj||}|ra|\}}|ra|j|j|tjj|||gSntjj|||S(sSLoad tests from all names, returning a suite containing all tests. (RRJtloadTestsFromNamesR&R)R(R+tnamesR|tplug_resR((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRs  cCsg}|jj}x$|j|D]}|j|q"W|sUtt|j|S|jgtt|j|D] }|^qt|j|S(s6Load tests from a unittest.TestCase subclass. (RRJtloadTestsFromTestCaseR[tsuperRRR&(R+R;R<RJtcase((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRs )cCs||jd}gt|t|D]!}|jt|||^q(}x*|jjj|D]}|j|qeW|j t |d|S(s!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. cSsMt||d}t|r0t||}nt|s@tS|j|S(N(R,RRRRR-R.(R/R0R1R2((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyR3s   Rz( R$R7R8RR,RRJtloadTestsFromTestClassR[R&R(R+R0R3RR<Rh((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRs :cCsy|j||SWn~ttfk r0netj}yt|}Wn tk ren d}nXt|d|d|dd|SXdS(NiiiRk(t _makeTestR\R]R^R_RRR(R+RRRpR((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRs   cCslg}yt|}Wn tk r,n d}nXx-|jjj||D]}|j|qRWy|r|j|SWnKttfk rn2t j }t |d|d|dd|SXt |r|rt |tj rt||}nt |tjr|St|r|rT|j|jkrTt||j}nt|tjrs|j|S|j|Snt|r|dkr|j}nt|tjr||jSt|r|j||St|Snyt |rQ|r(|j|jkr(t||j}nt|rD|j ||St!|Snt t"d|d|SdS(sVGiven a test object and its parent, return a test case or test suite. iiiRksCan't make a test from %sN(#RR\RRRJRR[R&R]R^R_RRRttypest ModuleTypeRR)tTestCaseRRRRt issubclassRRRt __class__RRRRR}RR(R+RRRRRhRp((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRsX   #%            cCsk|}|jd}x'|D]}|t||d}}qW|dkrattd|}n||fS(s#Resolve name within module RAsNo such test %sN(tsplitR,RRRn(R+RR|RtpartstpartR((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyROs  cCst|ts"|t}}nVt|dkrK|dt}}n-t|dksct|d|d}}||fS(sGiven the yield value of a test generator, return a func and args. This is used in the two loadTestsFromGenerator* methods. ii(RttupletlentAssertionError(R+RhRwRq((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyRs[sN(RRt__doc__RRR!R R$R&R*R6R>R@RDRYR}RR-RRWRRRRRRRs(((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyR,s0  )    M   ,1l     ; (=Rt __future__RtloggingRLR^R)RtinspectRtnose.pyversionRRt nose.caseRRt nose.failureRt nose.configRt nose.importerRR R t nose.selectorR R t nose.utilR RRRRRRRRRt nose.suiteRRRRRt getLoggerRRHR=tnormpathR"tabspathR#tjoinRPRRStisfileRQt__all__RR(((s</opt/alt/python27/lib/python2.7/site-packages/nose/loader.pyts6     F      @