Viewing File: /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/test.cpython-36.pyc

3

Xoh#@sddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddlm
Z
ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZGd	d
d
eZGdddeZGd
ddeZ dS)N)DistutilsErrorDistutilsOptionError)log)
TestLoader)six)mapfilter)	resource_listdirresource_existsnormalize_pathworking_set_namespace_packagesevaluate_markeradd_activation_listenerrequire
EntryPoint)Commandc@seZdZddZdddZdS)ScanningLoadercCstj|t|_dS)N)r__init__set_visited)selfr/usr/lib/python3.6/test.pyrs
zScanningLoader.__init__NcCs||jkrdS|jj|g}|jtj||t|drH|j|jt|drxpt|jdD]`}|j	dr|dkr|jd|dd}n"t
|j|d	r`|jd|}nq`|j|j|q`Wt|d
kr|j
|S|dSdS)
aReturn a suite of all tests cases contained in the given module

        If the module is a package, load tests from all the modules in it.
        If the module has an ``additional_tests`` function, call it and add
        the return value to the tests.
        Nadditional_tests__path__z.pyz__init__.py.z/__init__.pyr)raddappendrloadTestsFromModulehasattrrr	__name__endswithr
ZloadTestsFromNamelenZ
suiteClass)rmodulepatternZtestsfileZ	submodulerrrr#s$



z"ScanningLoader.loadTestsFromModule)N)r%
__module____qualname__rr#rrrrrsrc@seZdZddZdddZdS)NonDataPropertycCs
||_dS)N)fget)rr.rrrr>szNonDataProperty.__init__NcCs|dkr|S|j|S)N)r.)robjZobjtyperrr__get__AszNonDataProperty.__get__)N)r%r+r,rr0rrrrr-=sr-c@seZdZdZdZd%d&d'gZdd
ZddZeddZ	ddZ
ddZej
gfddZeej
ddZeddZddZddZed d!Zed"d#Zd$S)(testz.Command to run unit tests after in-place buildz#run unit tests after in-place buildtest-module=m$Run 'test_suite' in specified moduletest-suite=s9Run single test, case or suite (e.g. 'module.test_suite')test-runner=rTest runner to usecCsd|_d|_d|_d|_dS)N)
test_suitetest_moduletest_loadertest_runner)rrrrinitialize_optionsSsztest.initialize_optionscCs|jr|jrd}t||jdkrD|jdkr8|jj|_n|jd|_|jdkr^t|jdd|_|jdkrnd|_|jdkrt|jdd|_dS)Nz1You may specify a module or a suite, but not bothz.test_suiter=z&setuptools.command.test:ScanningLoaderr>)r;r<rdistributionr=getattrr>)rmsgrrrfinalize_optionsYs




ztest.finalize_optionscCst|jS)N)list
_test_args)rrrr	test_argslsztest.test_argsccs6|jrtjdkrdV|jr$dV|jr2|jVdS)NZdiscoverz	--verbose)rGrH)r;sysversion_infoverbose)rrrrrEpsztest._test_argsc	Cs|j|WdQRXdS)zI
        Backward compatibility for project_on_sys_path context.
        N)project_on_sys_path)rfuncrrrwith_project_on_sys_pathxs
ztest.with_project_on_sys_pathc	csPtjot|jdd}|rv|jddd|jd|jd}t|j}|jd|d|jd|jddd|jdn"|jd|jdd	d|jd|jd}t	j
dd}t	jj}zbt|j
}t	j
jd|tjtd
dtd|j|jf|j|gdVWdQRXWd|t	j
dd<t	jjt	jj|tjXdS)
Nuse_2to3FZbuild_pyr)ZinplaceZegg_info)egg_baseZ	build_extrcSs|jS)N)Zactivate)distrrr<lambda>sz*test.project_on_sys_path.<locals>.<lambda>z%s==%s)rPY3rAr@Zreinitialize_commandZrun_commandZget_finalized_commandrZ	build_librIpathmodulescopyrPinsertrrrrZegg_nameZegg_versionpaths_on_pythonpathclearupdate)	rZ
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmdZold_pathZold_modulesZproject_pathrrrrLs8









ztest.project_on_sys_pathccst}tjjd|}tjjdd}z>tjj|}td||g}tjj|}|rX|tjd<dVWd||krztjjddn
|tjd<XdS)z
        Add the indicated paths to the head of the PYTHONPATH environment
        variable so that subprocesses will also see the packages at
        these paths.

        Do this in a context that restores the value on exit.
        
PYTHONPATHrN)objectosenvirongetpathsepjoinrpop)pathsZnothingZorig_pythonpathZcurrent_pythonpathprefixZto_joinnew_pathrrrrXs


ztest.paths_on_pythonpathcCsD|j|j}|j|jpg}|jdd|jjD}tj|||S)z
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        css0|](\}}|jdrt|ddr|VqdS):rN)
startswithr).0kvrrr	<genexpr>sz%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ
tests_requireZextras_requireitems	itertoolschain)rQZir_dZtr_dZer_drrr
install_distss
ztest.install_distscCs|j|j}dj|j}|jr0|jd|dS|jd|ttjd|}|j	|"|j
|jWdQRXWdQRXdS)N zskipping "%s" (dry run)zrunning "%s"location)ror@ra_argvZdry_runannounceroperator
attrgetterrXrL	run_tests)rZinstalled_distscmdrcrrrruns
ztest.runcCstjrt|jddr|jjdd}|tkrg}|tjkrD|j	||d7}x"tjD]}|j
|rT|j	|qTWtttjj
|tjdd|j|j|j|j|jdd}|jjsd|j}|j|tjt|dS)NrOFrr)Z
testLoaderZ
testRunnerexitzTest failed: %s)rrSrAr@r;splitr
rIrUr"rgrDr__delitem__unittestmainrr_resolve_as_epr=r>resultZ
wasSuccessfulrsrZERRORr)rr(Zdel_modulesnamer1rBrrrrvs(






ztest.run_testscCsdg|jS)Nr|)rF)rrrrrrsz
test._argvcCs$|dkrdStjd|}|jS)zu
        Load the indicated attribute value, called, as a as if it were
        specified as an entry point.
        Nzx=)rparseZresolve)valZparsedrrrr~sztest._resolve_as_epN)r2r3r4)r5r6r7)r8r9r:)r%r+r,__doc__descriptionZuser_optionsr?rCr-rFrErN
contextlibcontextmanagerrLstaticmethodrXrorxrvpropertyrrr~rrrrr1Gs(-r1)!r]rtrIrrmr|Zdistutils.errorsrrZ	distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesr	r
rrr
rrrrZ
setuptoolsrrr\r-r1rrrr<module>s,)
Back to Directory File Manager