File "loader.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib64/python3.4/unittest/__pycache__/loader.cpython-34.pyc
File size: 12.48 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


j f@@sddZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZdZej
dejZGdd	d	e	jZd
dZdd
ZddZddZddZGdddeZeZdddZejddZdeje
jddZdeje
jddZdS)zLoading unittests.N)fnmatch)casesuiteutilTz[_a-z]\w*\.py$cs:eZdZdZfddZfddZS)_FailedTestNcs#||_tt|j|dS)N)
_exceptionsuperr__init__)selfZmethod_name	exception)	__class__4/opt/alt/python34/lib64/python3.4/unittest/loader.pyr
s	z_FailedTest.__init__cs;|jkr%ttj|Sfdd}|S)Ncs
jdS)N)rr)rrrtestFailure sz,_FailedTest.__getattr__.<locals>.testFailure)_testMethodNamer	r__getattr__)rnamer)r
)rrrsz_FailedTest.__getattr__)__name__
__module____qualname__rr
rrr)r
rrsrcCs,d|tjf}t|t||S)Nz#Failed to import test module: %s
%s)	traceback
format_exc_make_failed_testImportError)r
suiteClassmessagerrr_make_failed_import_test%srcCst|||S)N)r)rrrrrr_make_failed_load_tests)srcCst||}||fS)N)r)
methodnamerrtestrrrr,srcCsYtjt|dd}i||6}tdtjf|}|||fS)NcSsdS)Nr)rrrrtestSkipped1sz'_make_skipped_test.<locals>.testSkippedZ
ModuleSkipped)rskipstrtypeTestCase)rrrr!attrsZ	TestClassrrr_make_skipped_test0s!
r'cCs7|jjdr#|ddStjj|dS)Nz	$py.class	ri)lowerendswithospathsplitext)r,rrr_jython_aware_splitext8sr.c@seZdZdZdZeejZe	j
ZdZddZ
dddZdd	d
ZdddZd
dZddddZddZddZddZddZdddZdS)
TestLoaderz
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    r NcCsnt|tjr!tdn|j|}|rRt|drRdg}n|jt||}|S)z<Return a suite of all tests cases contained in testCaseClasszYTest cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?ZrunTest)
issubclassr	TestSuite	TypeErrorgetTestCaseNameshasattrrmap)r
testCaseClassZ
testCaseNamesZloaded_suiterrrloadTestsFromTestCaseHsz TestLoader.loadTestsFromTestCaseTcCsg}x]t|D]O}t||}t|trt|tjr|j|j|qqWt|dd}|j	|}|r|dk	ry|||dSWqt
k
r}zt|j||j	SWYdd}~XqXn|S)z?Return a suite of all tests cases contained in the given module
load_testsN)
dirgetattr
isinstancer$r0rr%appendr7r	Exceptionrr)rmoduleuse_load_teststestsrobjr8errrloadTestsFromModuleTs! zTestLoader.loadTestsFromModulec
Cs|jd}|dkr|dd}xL|ryytdj|}PWq.tk
ru|d=|sqnYq.Xq.W|dd}n|}x$|D]}|t||}}qWt|tjr|j|St|t	rt
|tjr|j
|St|tjr~t|t	r~t
|tjr~|d}||}tt||tjs|j|gSnt|tjr|St|r|}	t|	tjr|	St|	tjr|j|	gStd||	fntd|dS)aTReturn a suite of all tests 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.
        .Nrz"calling %s returned %s, not a testz$don't know how to make test from: %srE)split
__import__joinrr:r;types
ModuleTyperCr$r0rr%r7FunctionTyperrr1callabler2)
rrr>partsZ
parts_copyrApartparentZinstr rrrloadTestsFromNamefsJ		


!

	zTestLoader.loadTestsFromNamecs)fdd|D}j|S)zReturn a suite of all tests cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        cs"g|]}j|qSr)rP).0r)r>rrr
<listcomp>s	z1TestLoader.loadTestsFromNames.<locals>.<listcomp>)r)rnamesr>Zsuitesr)r>rrloadTestsFromNamesszTestLoader.loadTestsFromNamescCs\||jdd}tt|t|}|jrX|jdtj|jn|S)zLReturn a sorted sequence of method names found within testCaseClass
        cSs"|j|o!tt||S)N)
startswithrLr:)Zattrnamer6prefixrrrisTestMethodsz1TestLoader.getTestCaseNames.<locals>.isTestMethodkey)testMethodPrefixlistfilterr9sortTestMethodsUsingsort	functools
cmp_to_key)rr6rWZtestFnNamesrrrr3s	zTestLoader.getTestCaseNamesztest*.pycCsd}|dkr-|jdk	r-|j}n|dkrHd}|}ntjj|}|tjkrtjjd|n||_d}d}g}tjjtjj|rtjj|}||krtjjtjj|d}qnyt	|Wnt
k
r&d}YnXtj|}|jdd}	y%tjjtjj
|j}Wn!tk
ry
|j}
Wntk
rd}
YnX|
rO|
jdkrO|
jdk	rd}x{|jD]m}|r|j|rqn|j|jjdtjjd|_|j|j||ddqWqn<|jtjkrstddntd	j|dYnX|r|s|j|	|_tjj|qtjj|n|rt
d
|n|st|j||}n|j |S)aFind and return all test modules from the specified start
        directory, recursing into subdirectories to find them and return all
        tests found within 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().

        Paths are sorted before being imported to ensure reproducible execution
        order even on filesystems with non-alphabetical ordering like ext3/4.
        FNTrz__init__.pyrD	namespacez2Can not use builtin modules as dotted module namesz$don't know how to discover from {!r}z%Start directory is not importable: %r)!_top_level_dirr+r,abspathsysinsertisdirisfilerHrGrmodulesrFdirname__file__AttributeError__spec__loadersubmodule_search_locations__path__rUrreplacesepextend_find_testsbuiltin_module_namesr2format _get_directory_containing_moduleremoverZr)r	start_dirpatternZ
top_level_dirZset_implicit_topZis_not_importableis_namespacer@Z
the_moduleZtop_partspecr,rrrdiscoversv		(

	


		zTestLoader.discovercCsstj|}tjj|j}tjj|jjdr_tjj	tjj	|Stjj	|SdS)Nz__init__.py)
rcrgr+r,rbribasenamer)rUrh)rZmodule_namer>	full_pathrrrrus

!z+TestLoader._get_directory_containing_modulecCsttjj|}tjj||j}tjj|sOtd|jdsktd|j	tjj
d}|S)NzPath must be within the projectz..rD)r.r+r,normpathrelpathraisabsAssertionErrorrUrorp)rr,Z_relpathrrrr_get_name_from_path"szTestLoader._get_name_from_pathcCst|tj|S)N)rGrcrg)rrrrr_get_module_from_name,s
z TestLoader._get_module_from_namecCs
t||S)N)r)rr,r}rxrrr_match_path0szTestLoader._match_pathFccsttj|}x|D]}tjj||}tjj|rtj|s^qn|j|||syqn|j	|}y|j
|}WnTtjk
r}	zt
||	|jVWYdd}	~	Xqt||jVYqXtjjt|d|}
ttjj|
}ttjj|}|j|jkrtjj|}
ttjj|}tjj|}d}t|||
|fn|j|Vqtjj|r|rtjjtjj|drqnd}d}t||rk|j	|}|j
|}t|dd}|j|dd}n|dkr|dk	r|Vn|j||d|DdHqy||||VWqtk
r}	zt|j|	|jVWYdd}	~	XqXqqWdS)	z/Used by discovery. Yields test suites it loads.NrizW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?z__init__.pyr8r?Fr`)sortedr+listdirr,rHrfVALID_MODULE_NAMEmatchrrrrZSkipTestr'rrrbr:r.realpathr)rhr|rrCrerrrr=rr)rrwrxr`pathsr,r}rr>rBZmod_filerZfullpath_noextZ
module_dirZmod_nameZexpected_dirmsgr8r@packagerrrrr4s\
&"zTestLoader._find_tests)rrr__doc__rYstaticmethodr
three_way_cmpr\rr1rrar7rCrPrTr3r{rurrrrrrrrrr/>s 	3j
r/cCs1t}||_||_|r-||_n|S)N)r/r\rYr)rV	sortUsingrrlrrr_makeLoaderss			rcCst||j|S)N)rr3)r6rVrrrrr3{sr3r cCst|||j|S)N)rr7)r6rVrrrrr	makeSuite~srcCst|||j|S)N)rrC)r>rVrrrrr
findTestCasessr) rr+rercrrIr^rrrrZ
__unittestcompile
IGNORECASErr%rrrrr'r.objectr/ZdefaultTestLoaderrrr3r1rrrrrr<module>s23