Viewing File: /opt/alt/python35/lib/python3.5/site-packages/setuptools/command/__pycache__/test.cpython-35.pyc



\T#@s>ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZdd	lmZGd
ddeZGdd
d
e Z!GdddeZ"dS)N)DistutilsErrorDistutilsOptionError)log)
TestLoader)six)mapfilter)	resource_listdirresource_existsnormalize_pathworking_set_namespace_packagesevaluate_markeradd_activation_listenerrequire
EntryPoint)Command)
unittest_mainc@seZdZdddZdS)ScanningLoaderNcCsg}|jtj||t|drA|j|jt|drxt|jdD]}|jdr|dkr|jd|dd}n-t|j|d	rc|jd|}nqc|j|j	|qcWt
|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.
        additional_tests__path__z.pyz__init__.py.Nz/__init__.pyr)appendrloadTestsFromModulehasattrrr	__name__endswithr
ZloadTestsFromNamelenZ
suiteClass)selfmodulepatternZtestsfileZ	submoduler&/test.pyrs
z"ScanningLoader.loadTestsFromModule)r
__module____qualname__rr&r&r&r'rsrc@s+eZdZddZdddZdS)NonDataPropertycCs
||_dS)N)fget)r"r+r&r&r'__init__5szNonDataProperty.__init__NcCs|dkr|S|j|S)N)r+)r"objZobjtyper&r&r'__get__8szNonDataProperty.__get__)rr(r)r,r.r&r&r&r'r*4sr*c@seZdZdZdZd%d&d'gZdd
ZddZeddZ	ddZ
ddZej
gddZee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 usecCs(d|_d|_d|_d|_dS)N)
test_suitetest_moduletest_loadertest_runner)r"r&r&r'initialize_optionsJs			ztest.initialize_optionscCs|jr$|jr$d}t||jdkrd|jdkrT|jj|_n|jd|_|jdkrt|jdd|_|jdkrd|_|jdkrt|jdd|_dS)Nz1You may specify a module or a suite, but not bothz.test_suiter;z&setuptools.command.test:ScanningLoaderr<)r9r:rdistributionr;getattrr<)r"msgr&r&r'finalize_optionsPs	ztest.finalize_optionscCst|jS)N)list
_test_args)r"r&r&r'	test_argscsztest.test_argsccs#|jrdV|jr|jVdS)Nz	--verbose)verboser9)r"r&r&r'rCgs		ztest._test_argsc	Cs|j|WdQRXdS)zI
        Backward compatibility for project_on_sys_path context.
        N)project_on_sys_path)r"funcr&r&r'with_project_on_sys_pathms
ztest.with_project_on_sys_pathc	cstjot|jdd}|r|jddd|jd|jd}t|j}|jdd||jd|jddd|jdn-|jd|jddd	|jd|jd}t	j
dd}t	jj}zyt|j
}t	j
jd|tjtd
dtd|j|jf|j|g
dVWdQRXWd|t	j
dd<t	jjt	jj|tjXdS)
Nuse_2to3FZbuild_pyZinplacerZegg_infoegg_baseZ	build_extrcSs
|jS)N)Zactivate)distr&r&r'<lambda>sz*test.project_on_sys_path.<locals>.<lambda>z%s==%s)rPY3r?r>Zreinitialize_commandZrun_commandZget_finalized_commandrZ	build_libsyspathmodulescopyrJinsertrr,rrZegg_nameZegg_versionpaths_on_pythonpathclearupdate)	r"Z
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmdZold_pathZold_modulesZproject_pathr&r&r'rFts8





ztest.project_on_sys_pathccst}tjjd|}tjjdd}zUtjj|}td||g}tjj|}|r|tjd<dVWd||krtjjddn
|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_pathr&r&r'rSs
	
	ztest.paths_on_pythonpathcCsb|j|j}|j|jp$g}|jdd|jjD}tj|||S)z
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        css@|]6\}}|jdrt|ddr|VqdS):rN)
startswithr).0kvr&r&r'	<genexpr>s	z%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ
tests_requireZextras_requireitems	itertoolschain)rKZir_dZtr_dZer_dr&r&r'
install_distss
ztest.install_distscCs|j|j}dj|j}|jrB|jd|dS|jd|ttjd|}|j	|#|j
|jWdQRXWdQRXdS)N zskipping "%s" (dry run)zrunning "%s"location)rjr>r\_argvdry_runannounceroperator
attrgetterrSrF	run_tests)r"Zinstalled_distscmdr^r&r&r'runs	
ztest.runc	CsQtjrt|jddr|jjdd}|tkrg}|tjkrb|j	||d7}x-tjD]"}|j
|rv|j	|qvWtttjj
|tjdkrin	ddi}tdd|jd|j|jd	|j|j|}|jjsMd
|j}|j|tjt|dS)NrIFrrexitZ
testLoaderZ
testRunnerzTest failed: %s)rurv)rrMr?r>r9splitr
rNrPrrbrBr__delitem__version_inforrm_resolve_as_epr;r<resultZ
wasSuccessfulrorERRORr)r"r#Zdel_modulesnameZ
exit_kwargr/r@r&r&r'rrs*

!	
ztest.run_testscCsdg|jS)Nunittest)rD)r"r&r&r'rmsz
test._argvcCs0|dkrdStjd|}|jS)zu
        Load the indicated attribute value, called, as a as if it were
        specified as an entry point.
        Nzx=)rparseZresolve)valZparsedr&r&r'r{sztest._resolve_as_epN)r0r1r2)r3r4r5)r6r7r8)rr(r)__doc__descriptionZuser_optionsr=rAr*rDrCrH
contextlibcontextmanagerrFstaticmethodrSrjrtrrpropertyrmr{r&r&r&r'r/>s(	-r/)#rXrprNrrhZdistutils.errorsrrZ	distutilsrrrZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesr	r
rrr
rrrrZ
setuptoolsrZsetuptools.py31compatrrrWr*r/r&r&r&r'<module>s@ 
Back to Directory File Manager