Ñò ­ñHc @s¸dZddkZddkZddkZddklZddklZddkl Z ei dƒZ ei djZ d dd „ƒYZd dd „ƒYZd efd„ƒYZdS(sAttribute selector plugin. Simple syntax (-a, --attr) examples: * `nosetests -a status=stable`: Only test cases with attribute "status" having value "stable" * `nosetests -a priority=2,status=stable`: Both attributes must match * `nosetests -a priority=2 -a slow`: Either attribute must match * `nosetests -a tags=http`: Attribute list "tags" must contain value "http" (see test_foobar() below for definition) * `nosetests -a slow`: Attribute "slow" must be defined and its value cannot equal to False (False, [], "", etc...) * `nosetests -a '!slow'`: Attribute "slow" must NOT be defined or its value must be equal to False. Note the quotes around the value -- this may be necessary if your shell interprets `!' as a special character. Eval expression syntax (-A, --eval-attr) examples: * `nosetests -A "not slow"` * `nosetests -A "(priority > 5) and not slow"` iÿÿÿÿN(t isfunction(tPlugin(ttolistsnose.plugins.attribiit ContextHelpercBs eZdZd„Zd„ZRS(s.Returns default values for dictionary lookups.cCs ||_dS(N(tobj(tselfR((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt__init__.scCs|ii|tƒS(N(RtgettFalse(Rtname((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt __getitem__1s(t__name__t __module__t__doc__RR (((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyR,s tAttributeGettercBs,eZdZeƒZd„Zdd„ZRS(sHelper for looking up attributes First we check the method, and if the attribute is not present, we check the method's class. cCs||_||_dS(N(tclstmethod(RRR((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyR=s cCs‡tid||i|iƒ|iii||iƒ}||ijo<tid|ƒt|i||ƒ}tid||ƒn|S(NsGet %s from %s.%ss-No attribute %s in method, getting from classsClass attribute %s value: %s(tlogtdebugRRt__dict__Rtmissingtgetattr(RR tdefaulttval((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyRAs N(R R R tobjectRRtNoneR(((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyR5s  tAttributeSelectorcBsSeZdZd„Zeid„Zd„Zd„Zd„Z d„Z d„Z RS(s<Selects test cases to be run based on their attributes. cCsti|ƒg|_dS(N(RRtattribs(R((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyROs c Csw|iddddddd|idƒd d ƒto;|id d dd ddddd|idƒd dƒndS(s)Add command-line options for this plugin.s-as--attrtdesttattrtactiontappendRt NOSE_ATTRthelpsARun only tests that have attributes specified by ATTR [NOSE_ATTR]s-As --eval-attrt eval_attrtmetavartEXPRtNOSE_EVAL_ATTRsaRun only tests for whose attributes the Python expression EXPR evaluates to True [NOSE_EVAL_ATTR]N(t add_optionRt compat_24(Rtparsertenv((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pytoptionsSs c Csjg|_toP|ioFt|iƒ}x4|D](}d„}|ii||fgƒq0Wn|ioåt|iƒ}xÓ|D]Ç}g}x¨|iƒidƒD]‘}|pq¢n|iddƒ} t| ƒdjo| \} } n6| d} | ddjo| d} t } nt } |i| | fƒq¢W|ii|ƒq€Wn|io t |_ ndS(sConfigure the plugin and system, based on selected options. attr and eval_attr may each be lists. self.attribs will be a list of lists of tuples. In that list, each list is a group of attributes, all of which must match for the rule to match. cSst|dt|ƒƒS(N(tevalRR(texprR((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyteval_in_contextust,t=iit!N( RR'R"RRRtstriptsplittlenRtTruetenabled( RR*tconfigR"RR-tstd_attrt attr_grouptattribtitemstkeytvalue((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt configureds8  !     c Cszt}xa|iD]V}t}x:|D]2\}}|i|ƒ}t|ƒo|||ƒp t}PqUq#|tjot|ƒp t}PqUq#|tjot|ƒo t}PqUq#t|ƒttfjoC|g}|D]} |t | ƒi ƒqã~jo t}PqUq#||jo0t |ƒi ƒt |ƒi ƒjo t}Pq#q#W|p|}qW|odStS(N( RRR4RtcallabletboolttypetlistttupletstrtlowerR( RRtanytgrouptmatchR;R<t obj_valuet_[1]tx((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pytvalidateAttrib™s>          4  % cCsg|i}|i|ƒtj odStt|iƒƒ}td„t|i|ƒƒ}|odStS(s?Accept the class if the class or any method is wanted. cSs |tj S((R(tm((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pytËsN( RRKRRtfilterRtvaluestmapt wantFunction(RRtcls_attrtmethodstwanted((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt wantClassÃs  cCs|i|iƒS(N(RKR(Rtfunction((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyRQÑscCst|i|ƒ}|i|ƒS(N(Rtim_classRK(RRR((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt wantMethodÔs( R R R RtostenvironR*R=RKRURQRX(((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyRKs  5 *  (ii(((R tloggingRYtsystinspectRtnose.plugins.baseRt nose.utilRt getLoggerRt version_infoR'RRR(((s7/usr/lib/python2.6/site-packages/nose/plugins/attrib.pyt!s