mò (”)Cc@sydkZdkZdkZdkZdeifd„ƒYZdefd„ƒYZd„Zdeifd„ƒYZ dS(Nt FunctionTestcBs)tZdZd„Zd„Zd„ZRS(sRuns a single function as a test. Produces output that looks a little different than that of unittest's own FunctionTestCase.cGs&||_||_tii|ƒdS(s(@param func: function to run as a test.N(tfunctselftargstunittesttTestCaset__init__(RRR((t8/Users/tazzzzz/projects/testgears/testgears/collector.pyR s  cCs=|iio|ii}n |ii}d||iifS(sVUses the function's doc string as the ideal form. Otherwise, the name is used.s%s (%s)N(RRt__doc__tnamet func_namet __module__(RR ((RtshortDescriptions   cCs|i|iŒdS(N(RRR(R((RtrunTests(t__name__R RRR R (((RRs   t SetupFunctioncBstZdZd„ZRS(s‚Runs a setup or teardown function. Does not count in the total test count, but masquerades as a test for convenient execution.cCsdS(Ni((R((RtcountTestCases s(RR RR(((RRs cCst|ii|iiƒS(sLCompares two functions' line numbers to ensure tests run in file order.N(tcmptat func_codetco_firstlinenotb(RR((RtcmpFunctionLocation#st CollectorcBs2tZdZeZed„Zd„Zd„ZRS(sTA TestSuite that is automatically built from tests in the supplied package. c Cstt|ƒiƒ|oti|ƒ|_nt|t ƒt ƒƒ} t i i t i i| iƒƒ}x˜t i|ƒD]‡\}}}d|jp d|joqyn|t|ƒd}|o&d||it i idƒf}n|}|i||ƒqyWdS(s™@packagename a string name for the package to look up and search @regex a regular expression to match against filenames and test namess.svns.cvsis%s.%st.N(tsuperRRRtregextretcompilet __import__t packagenametdicttmodtostpathtabspathtdirnamet__file__t packagedirtwalktroottdirstfilestlent currentdirtreplacetseptcurrentpackaget _processFiles( RRRR)R,R/R&R(R*R ((RR/s!&cCsœ|i}xŒ|D]„}t}|o|i|ƒo t}qAn|idƒoCt i i |ƒ\}}|djoqn|i|||ƒqqWdS(Nttest_s.py(RRR*tfiletFalsetismatchtsearchtTruet startswithR!R"tsplitexttfilenametextt_processModuleR/(RR*R/RR9R:R4R2((RR0Hs   c Cs¦|i}td||ftƒtƒ|ƒ} t| ƒ} t | dƒo|i t | i | ƒƒng}xÔ| D]Ì}|o | o|i|ƒ oqtnt| |ƒ}t|ƒtijo6t|tiƒo#ti}|i |i|ƒƒqtt|ƒtijo.|iƒidƒpqtn|i|ƒqtqtW|i t!ƒx!|D]} |i t#| ƒƒqXWt | dƒo|i t | i$| ƒƒndS(Ns%s.%st setup_modulettesttteardown_module(%RRRR/R9RR tdirt candidatesthasattrtaddTestRR<t addInOrdert candidatenameR4R5tgetattrt candidatettypettypestTypeTypet issubclassRRtdefaultTestLoadertloadertloadTestsFromTestCaset FunctionTypetlowerR7tappendtsortRRRR>( RR9R/R4RLRRFRCRDR@RR ((RR;Ws2   )  (RR RtNoneRRR0R;(((RR)s   ( RR!RHRRRRRt TestSuiteR(RRRRRRR!RH((Rt?s