File "loader.cpython-37.pyc"

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

B

 fX@sdZddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZm
Z
dZedejZGdd	d	ejZd
dZdd
ZddZddZddZGdddeZeZdddZe
jdfddZde
jejfddZ de
jejfddZ!dS) zLoading unittests.N)fnmatchfnmatchcase)casesuiteutilTz[_a-z]\w*\.py$cs,eZdZdZfddZfddZZS)_FailedTestNcs||_tt||dS)N)
_exceptionsuperr__init__)selfZmethod_name	exception)	__class__4/opt/alt/python37/lib64/python3.7/unittest/loader.pyrsz_FailedTest.__init__cs*|jkrtt|Sfdd}|S)Ncs
jdS)N)r	r)rrrtestFailure!sz,_FailedTest.__getattr__.<locals>.testFailure)_testMethodNamer
r__getattr__)rnamer)r)rrrs
z_FailedTest.__getattr__)__name__
__module____qualname__rrr
__classcell__rr)rrrsrcCs"d|tf}t|t|||S)Nz#Failed to import test module: %s
%s)	traceback
format_exc_make_failed_testImportError)r
suiteClassmessagerrr_make_failed_import_test&srcCsdtf}t||||S)NzFailed to call load_tests:
%s)rrr)rr
rrrrr_make_failed_load_tests+sr cCst||}||f|fS)N)r)
methodnamer
rrtestrrrr0s
rcCs<tt|dd}||i}tdtjf|}|||fS)NcSsdS)Nr)rrrrtestSkipped5sz'_make_skipped_test.<locals>.testSkippedZ
ModuleSkipped)rskipstrtypeTestCase)r!r
rr#ZattrsZ	TestClassrrr_make_skipped_test4sr(cCs*|dr|ddStj|dS)Nz	$py.classir)lowerendswithospathsplitext)r,rrr_jython_aware_splitext<sr.cseZdZdZdZeejZdZ	e
jZdZ
fddZddZddd	d
Zd!ddZd"d
dZddZd#ddZddZddZddZddZd$ddZd%dd ZZS)&
TestLoaderz
    This class is responsible for loading tests according to various criteria
    and returning them wrapped in a TestSuite
    r"Ncs tt|g|_t|_dS)N)r
r/rerrorsset_loading_packages)r)rrrrMszTestLoader.__init__cCsFt|tjrtd||}|s2t|dr2dg}|t||}|S)z;Return a suite of all test 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_suiterrrloadTestsFromTestCaseTs
z TestLoader.loadTestsFromTestCase)patternc

Os4t|dksd|kr,tdt|ddt|dkrRt|d}td|t|dkrxt|d}td|g}x@t|D]4}t	||}t
|trt|t
jr|||qWt	|dd}	||}|	dk	r0y|	|||Stk
r.}
z$t|j|
|j\}}|j||Sd}
~
XYnX|S)	z>Return a suite of all test cases contained in the given modulerZuse_load_testsz(use_load_tests is deprecated and ignoredNrzCloadTestsFromModule() takes 1 positional argument but {} were givenz=loadTestsFromModule() got an unexpected keyword argument '{}'
load_tests)lenwarningswarnDeprecationWarningpopr5formatsorteddirgetattr
isinstancer&r3rr'appendr:r	Exceptionr rr0)
rmoduler;argsZkwsZ	complainttestsrobjr<e
error_case
error_messagerrrloadTestsFromModulebs4


zTestLoader.loadTestsFromModulecCs>|d}d\}}|dkr|dd}xb|ryd|}t|}PWq(tk
r|}t||j\}}|s|j||SYq(Xq(W|dd}|}	x|D]}
y|	t	|	|
}}	Wqt
k
r2}zZt	|	dddk	r|dk	r|j||St|
||jdt
f\}}|j||SWdd}~XYqXqWt|	tjrP||	St|	trtt|	tjrt||	St|	tjrt|trt|tjr|d}||}
tt	|
|tjs||
gSnt|	tjr|	St|	r.|	}t|tjr|St|tjr||gStd|	|fntd	|	dS)
aSReturn 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.
        .)NNNr__path__zFailed to access attribute:
%sz"calling %s returned %s, not a testz$don't know how to make test from: %s)splitjoin
__import__rrArrr0rGrEAttributeErrorrrrrFtypes
ModuleTyperPr&r3rr'r:FunctionTyperr4callabler5)rrrIpartsrNrOZ
parts_copymodule_nameZnext_attributerLpartparentrMinstr"rrrloadTestsFromNamesl	





zTestLoader.loadTestsFromNamecsfdd|D}|S)zReturn a suite of all test cases found using the given sequence
        of string specifiers. See 'loadTestsFromName()'.
        csg|]}|qSr)ra).0r)rIrrr
<listcomp>sz1TestLoader.loadTestsFromNames.<locals>.<listcomp>)r)rnamesrIZsuitesr)rIrrloadTestsFromNamesszTestLoader.loadTestsFromNamescs>fdd}tt|t}jr:|jtjd|S)zLReturn a sorted sequence of method names found within testCaseClass
        csZ|jsdSt|}t|s&dSdjj|fjdkpXtfddjDS)NFz%s.%s.%sc3s|]}t|VqdS)N)r)rbr;)fullNamerr	<genexpr>szKTestLoader.getTestCaseNames.<locals>.shouldIncludeMethod.<locals>.<genexpr>)
startswithtestMethodPrefixrEr[rrtestNamePatternsany)ZattrnameZtestFunc)rr9)rfrshouldIncludeMethods

z8TestLoader.getTestCaseNames.<locals>.shouldIncludeMethod)key)listfilterrDsortTestMethodsUsingsort	functools
cmp_to_key)rr9rlZtestFnNamesr)rr9rr6s
zTestLoader.getTestCaseNamestest*.pycCsNd}|dkr|jdk	r|j}n|dkr.d}|}tj|}|tjkrRtjd|||_d}d}g}tjtj|rtj|}||krtjtj|d}ntyt	|Wnt
k
rd}YnNXtj|}|dd}	ytjtj
|j}Wntk
ry
|j}
Wntk
r8d}
YnX|
r|
jdkr|
jdk	rd}x|jD]P}|s~||s~qd||jdtjjd|_||j||ddqdWn*|jtjkrtddntd	|dYnX|r|s||	|_tj|ntj||r.t
d
||sDt|||}| |S)a%Find 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) unless
        the package has already had load_tests called from the same discovery
        invocation, in which case the package module object is not scanned for
        tests - this ensures that when a package uses discover to further
        discover child tests that infinite recursion does not happen.

        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__.pyrQ)	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,abspathsysinsertisdirisfilerUrVrmodulesrTdirname__file__rW__spec__loadersubmodule_search_locationsrRrhrreplacesepextend_find_testsbuiltin_module_namesr5rB _get_directory_containing_moduleremovernr)r	start_dirr;Z
top_level_dirZset_implicit_topZis_not_importableis_namespacerKZ
the_moduleZtop_partspecr,rrrdiscoversv





zTestLoader.discovercCsRtj|}tj|j}tj|drBtj	tj	|Stj	|SdS)Nz__init__.py)
rxr|r+r,rwr~basenamer)rhr})rr]rI	full_pathrrrr`s

z+TestLoader._get_directory_containing_modulecCsh||jkrdSttj|}tj||j}tj|rBtd|drTtd|	tjj
d}|S)NrQzPath must be within the projectz..)rvr.r+r,normpathrelpathisabsAssertionErrorrhrr)rr,Z_relpathrrrr_get_name_from_pathls
zTestLoader._get_name_from_pathcCst|tj|S)N)rVrxr|)rrrrr_get_module_from_namexsz TestLoader._get_module_from_namecCs
t||S)N)r)rr,rr;rrr_match_path|szTestLoader._match_pathFc

cs||}|dkrD||jkrD||||\}}|dk	r<|V|sDdStt|}x||D]t}tj||}	||	||\}}|dk	r|V|rX||	}|j|z|	|	||EdHWd|j
|XqXWdS)z/Used by discovery. Yields test suites it loads.rQN)rr2_find_test_pathrCr+listdirr,rUaddrdiscard)
rrr;rurrKZshould_recursepathsr,rrrrrs*


zTestLoader._find_testsc
CsPtj|}tj|rHt|s(dS||||s:dS||}y||}WnZt	j
k
r}zt|||jdfSd}~XYnt
||j\}}	|j|	|dfStjt|d|}
ttj|
}ttj|}||kr2tj|}
ttj|}tj|}d}t|||
|f|j||ddfSntj|rH|sxtjtj|dsxdSd}d}||}y||}Wn\t	j
k
r}zt|||jdfSd}~XYnzt
||j\}}	|j|	|dfSt|dd}|j|z(|j||d}|dk	r0|dfS|d	fS|j|XndSdS)
zUsed by discovery.

        Loads tests from a single file, or a directories' __init__.py when
        passed the directory.

        Returns a tuple (None_or_tests_from_file, should_recurse).
        )NFFNr~zW%r module incorrectly imported from %r. Expected %r. Is this module globally installed?)r;z__init__.pyr<T)r+r,rr{VALID_MODULE_NAMEmatchrrrrZSkipTestr(rrr0rGrwrEr.realpathr)r}rrPrzrUr2rr)rrr;rurrrIrMrNrOZmod_filerZfullpath_noextZ
module_dirZmod_nameZexpected_dirmsgr<rKpackagerrrrsl



zTestLoader._find_test_path)N)N)rtN)F)F)rrr__doc__ristaticmethodr
three_way_cmprprjrr4rrvrr:rPrarer6rrrrrrrrrr)rrr/Bs&
(
N

n
"r/cCs&t}||_||_||_|r"||_|S)N)r/rprirjr)prefix	sortUsingrrjrrrr_makeLoadersrcCst|||d|S)N)rj)rr6)r9rrrjrrrr6sr6r"cCst||||S)N)rr:)r9rrrrrr	makeSuitesrcCst||||S)N)rrP)rIrrrrrr
findTestCasessr)NN)"rr+rerxrrXrrr>rrrrrZ
__unittestcompile
IGNORECASErr'rrr rr(r.objectr/ZdefaultTestLoaderrrr6r4rrrrrr<module>s8/