usr/lib64/python2.7/unittest/loader.pyc000064400000026160147204656110013722 0ustar00 {fc@sdZddlZddlZddlZddlZddlZddlmZddl m Z ddl m Z m Z e ZejdejZdZd Zd Zd efd YZeZed ZedZdee jdZdee jdZdS(sLoading unittests.iN(t cmp_to_key(tfnmatchi(tcasetsuites[_a-z]\w*\.py$cCs/d|tjf}td|t||S(Ns#Failed to import test module: %s %stModuleImportFailure(t tracebackt format_exct_make_failed_testt ImportError(tnamet suiteClasstmessage((s'/usr/lib64/python2.7/unittest/loader.pyt_make_failed_import_testscCstd|||S(NtLoadTestsFailure(R(R t exceptionR ((s'/usr/lib64/python2.7/unittest/loader.pyt_make_failed_load_testsscsGfd}i||6}t|tjf|}|||fS(Ncs dS(N((tself(R(s'/usr/lib64/python2.7/unittest/loader.pyt testFailures(ttypeRtTestCase(t classnamet methodnameRR Rtattrst TestClass((Rs'/usr/lib64/python2.7/unittest/loader.pyRs t TestLoadercBseZdZdZeZejZdZ dZ e dZ ddZddZdZdddZd Zd Zd Zd Zd ZRS(s This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite ttestcCsnt|tjr!tdn|j|}| rRt|drRdg}n|jt||}|S(s;Return a suite of all test cases contained in testCaseClasssYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?trunTest(t issubclassRt TestSuitet TypeErrortgetTestCaseNamesthasattrR tmap(Rt testCaseClasst testCaseNamest loaded_suite((s'/usr/lib64/python2.7/unittest/loader.pytloadTestsFromTestCase0s cCsg}x]t|D]O}t||}t|trt|tjr|j|j|qqWt|dd}|j |}|r|dk ry|||dSWqt k r}t |j ||j SXn|S(s>Return a suite of all test cases contained in the given modulet load_testsN(tdirtgetattrt isinstanceRRRRtappendR$tNoneR t ExceptionRt__name__(Rtmoduletuse_load_teststtestsR tobjR%te((s'/usr/lib64/python2.7/unittest/loader.pytloadTestsFromModule;s! c Cs|jd}|dkr}|}xK|roytdj|}PWq%tk rk|d=|slqlq%Xq%W|d}n|}x$|D]}|t||}}qWt|tjr|j |St|t rt |t j r|j|St|tjrPt|t rPt |t j rP|d}||}|j|gSt|tjrf|St|dr|} t| tjr| St| t j r|j| gStd|| fntd|dS(sSReturn a suite of all test cases given a string specifier. The name may resolve either to a module, a test case class, a test method within a test case class, or a callable object which returns a TestCase or TestSuite instance. The method optionally resolves the names relative to a given module. t.iit__call__s"calling %s returned %s, not a tests$don't know how to make test from: %sN(tsplitR*t __import__tjoinRR'R(ttypest ModuleTypeR2RRRRR$tUnboundMethodTypeR RRRR( RR R-tpartst parts_copyR0tparttparenttinstR((s'/usr/lib64/python2.7/unittest/loader.pytloadTestsFromNameMsH       !    cCs2g|D]}|j||^q}|j|S(sReturn a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. (R@R (RtnamesR-R tsuites((s'/usr/lib64/python2.7/unittest/loader.pytloadTestsFromNames~s%cCsP||jd}t|t|}|jrL|jdt|jn|S(sLReturn a sorted sequence of method names found within testCaseClass cSs%|j|o$tt||dS(NR4(t startswithRR'(tattrnameR!tprefix((s'/usr/lib64/python2.7/unittest/loader.pyt isTestMethodstkey(ttestMethodPrefixtfilterR&tsortTestMethodsUsingtsortt _CmpToKey(RR!RGt testFnNames((s'/usr/lib64/python2.7/unittest/loader.pyRs  stest*.pyc Cst}|dkr-|jdk r-|j}n|dkrHt}|}ntjj|}|tjkrtjjd|n||_t}tjj tjj|rtjj|}||krtjj tjj |d }qnyt |Wnt k rt}nmXtj|}|jdd}tjjtjj|j}|r|j||_tjj|n|rt d|nt|j||}|j|S(s+Find and return all test modules from the specified start directory, recursing into subdirectories to find them. Only test files that match the pattern will be loaded. (Using shell style pattern matching.) All test modules must be importable from the top level of the project. If the start directory is not the top level directory then the top level directory must be specified separately. If a test package name (directory with '__init__.py') matches the pattern then the package will be checked for a 'load_tests' function. If this exists then it will be called with loader, tests, pattern. If load_tests exists then discovery does *not* recurse into the package, load_tests is responsible for loading all tests in the package. The pattern is deliberately not stored as a loader attribute so that packages can continue discovery themselves. top_level_dir is stored so load_tests does not need to pass this argument in to loader.discover(). is __init__.pyR3s%Start directory is not importable: %rN(tFalseR*t_top_level_dirtTruetostpathtabspathtsystinserttisdirtisfileR7R6RtmodulesR5tdirnamet__file__t _get_directory_containing_moduletremovetlistt _find_testsR ( Rt start_dirtpatternt top_level_dirtset_implicit_toptis_not_importablet the_modulettop_partR/((s'/usr/lib64/python2.7/unittest/loader.pytdiscovers:     (   !cCsstj|}tjj|j}tjj|jjdr_tjj tjj |Stjj |SdS(Ns __init__.py( RURYRRRSRTR[tbasenametlowerRDRZ(Rt module_nameR-t full_path((s'/usr/lib64/python2.7/unittest/loader.pyR\s  !cCstjjtjj|d}tjj||j}tjj| sYtd|jd sutd|j tjj d}|S(NisPath must be within the projects..R3( RRRStsplitexttnormpathtrelpathRPtisabstAssertionErrorRDtreplacetsep(RRSt_relpathR ((s'/usr/lib64/python2.7/unittest/loader.pyt_get_name_from_paths "cCst|tj|S(N(R6RURY(RR ((s'/usr/lib64/python2.7/unittest/loader.pyt_get_module_from_names cCs t||S(N(R(RRSRkRa((s'/usr/lib64/python2.7/unittest/loader.pyt _match_pathsccstj|}x|D]}tjj||}tjj|rtj|sXqn|j|||ssqn|j|}y|j |}Wnt ||j VqXtjj t |d|}tjjtjj|d} tjjtjj|d} | j| jkrtjj| } tjjtjj|d} tjj|} d}t|| | | fn|j|Vqtjj|rtjjtjj|dsqnd}d}t||r?|j|}|j |}t |dd}|j|dt}n|dkr|dk r_|Vnxd|j||D] }|VqrWqy||||VWqtk r}t|j||j VqXqqWdS(s/Used by discovery. Yields test suites it loads.R[isW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?s __init__.pyR%R.N(RRtlistdirRSR7RXtVALID_MODULE_NAMEtmatchRvRtRuR R RTR'RltrealpathRiRZRhRR2RWR*RROR_R+RR,(RR`RatpathsRSRkR R-tmod_fileRztfullpath_noextt module_dirtmod_namet expected_dirtmsgR%R/tpackageRR1((s'/usr/lib64/python2.7/unittest/loader.pyR_sV """!    N(R,t __module__t__doc__RItcmpRKRRR R*RPR$RQR2R@RCRRgR\RtRuRvR_(((s'/usr/lib64/python2.7/unittest/loader.pyR&s    1  @  cCs1t}||_||_|r-||_n|S(N(RRKRIR (RFt sortUsingR tloader((s'/usr/lib64/python2.7/unittest/loader.pyt _makeLoader+s     cCst||j|S(N(RR(R!RFR((s'/usr/lib64/python2.7/unittest/loader.pyR3sRcCst|||j|S(N(RR$(R!RFRR ((s'/usr/lib64/python2.7/unittest/loader.pyt makeSuite6scCst|||j|S(N(RR2(R-RFRR ((s'/usr/lib64/python2.7/unittest/loader.pyt findTestCases:s(RRRtreRURR8t functoolsRRMRtRRRQt __unittesttcompilet IGNORECASERxR RRtobjectRtdefaultTestLoaderR*RRRRRR(((s'/usr/lib64/python2.7/unittest/loader.pyts,