Your IP : 3.147.42.34


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



�ReT#�@s>ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZdd	lmZGd
d�de�ZGdd
�d
e �Z!Gdd�de�Z"dS)�N)�DistutilsError�DistutilsOptionError)�log)�
TestLoader)�six)�map�filter)	�resource_listdir�resource_exists�normalize_path�working_set�_namespace_packages�evaluate_marker�add_activation_listener�require�
EntryPoint)�Command)�
unittest_mainc@seZdZddd�ZdS)�ScanningLoaderNcCsg}|jtj||��t|d�rA|j|j��t|d�r�x�t|jd�D]�}|jd�r�|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�.N�z/__init__.py�r���)�appendr�loadTestsFromModule�hasattrrr	�__name__�endswithr
ZloadTestsFromName�lenZ
suiteClass)�self�module�pattern�tests�file�	submodule�r(��/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/command/test.pyrs
z"ScanningLoader.loadTestsFromModule)r�
__module__�__qualname__rr(r(r(r)rsrc@s+eZdZdd�Zddd�ZdS)�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.r0r(r(r(r)r,4sr,c@s�eZdZdZdZd%d&d'gZdd
�Zdd�Zedd��Z	dd�Z
dd�Zej
gdd��Zeej
dd���Zedd��Zdd�Zdd�Zed 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 module�test-suite=�s�9Run single test, case or suite (e.g. 'module.test_suite')�test-runner=�r�Test runner to usecCs(d|_d|_d|_d|_dS)N)�
test_suite�test_module�test_loader�test_runner)r"r(r(r)�initialize_optionsJs			ztest.initialize_optionscCs�|jr$|jr$d}t|��|jdkrd|jdkrT|jj|_n|jd|_|jdkr�t|jdd�|_|jdkr�d|_|jdkr�t|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>)r"�msgr(r(r)�finalize_optionsPs	ztest.finalize_optionscCst|j��S)N)�list�
_test_args)r"r(r(r)�	test_argscsztest.test_argsccs#|jrdV|jr|jVdS)Nz	--verbose)�verboser;)r"r(r(r)rEgs		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	cs�tjot|jdd�}|r�|jddd�|jd�|jd�}t|j�}|jdd|�|jd�|jddd�|jd�n-|jd�|jddd	�|jd�|jd�}t	j
dd�}t	jj�}zyt|j
�}t	j
jd|�tj�td
d��td|j|jf�|j|g��
dVWdQRXWd|t	j
dd�<t	jj�t	jj|�tj�XdS)
N�use_2to3F�build_pyZinplacer�egg_info�egg_base�	build_extrcSs
|j�S)N)�activate)�distr(r(r)�<lambda>�sz*test.project_on_sys_path.<locals>.<lambda>z%s==%s)r�PY3rAr@�reinitialize_command�run_command�get_finalized_commandr�	build_lib�sys�path�modules�copyrN�insertrr.rr�egg_nameZegg_version�paths_on_pythonpath�clear�update)	r"Z
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmd�old_pathZold_modulesZproject_pathr(r(r)rHts8





ztest.project_on_sys_pathccs�t�}tjjd|�}tjjdd�}zUtjj|�}td||g�}tjj|�}|r�|tjd<dVWd||kr�tjjdd�n
|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)�object�os�environ�get�pathsep�joinr�pop)�pathsZnothingZorig_pythonpathZcurrent_pythonpath�prefixZto_join�new_pathr(r(r)r^�s
	
	ztest.paths_on_pythonpathcCsb|j|j�}|j|jp$g�}|jdd�|jj�D��}tj|||�S)z�
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        css@|]6\}}|jd�rt|dd��r|VqdS)�:rN)�
startswithr)�.0�k�vr(r(r)�	<genexpr>�s	z%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ
tests_requireZextras_require�items�	itertools�chain)rQZir_dZtr_dZer_dr(r(r)�
install_dists�s
ztest.install_distscCs�|j|j�}dj|j�}|jrB|jd|�dS|jd|�ttjd�|�}|j	|��#|j
��|j�WdQRXWdQRXdS)N� zskipping "%s" (dry run)zrunning "%s"�location)rvr@rh�_argv�dry_run�announcer�operator�
attrgetterr^rH�	run_tests)r"Zinstalled_dists�cmdrjr(r(r)�run�s	
ztest.runc	CsQtjr�t|jdd�r�|jjd�d}|tkr�g}|tjkrb|j	|�|d7}x-tjD]"}|j
|�rv|j	|�qvWtttjj
|��tjdkr�in	ddi}tdd|jd|j|j�d	|j|j�|�}|jj�sMd
|j}|j|tj�t|��dS)NrKFrr���exitZ
testLoaderZ
testRunnerzTest failed: %s)r�r�)rrSrAr@r;�splitr
rXrZrrnrDr�__delitem__�version_inforry�_resolve_as_epr=r>�resultZ
wasSuccessfulr{r�ERRORr)r"r#Zdel_modules�nameZ
exit_kwargr1rBr(r(r)r~�s*

!	
ztest.run_testscCsdg|jS)N�unittest)rF)r"r(r(r)ry�sz
test._argvcCs0|dkrdStjd|�}|j��S)zu
        Load the indicated attribute value, called, as a as if it were
        specified as an entry point.
        Nzx=)r�parse�resolve)�val�parsedr(r(r)r��sztest._resolve_as_epN)r2r3r4)r5r6r7)r8r9r:)rr*r+�__doc__�description�user_optionsr?rCr,rFrErJ�
contextlib�contextmanagerrH�staticmethodr^rvr�r~�propertyryr�r(r(r(r)r1>s(	-r1)#rdr|rXr�rt�distutils.errorsrr�	distutilsrr�rZsetuptools.externrZsetuptools.extern.six.movesrr�
pkg_resourcesr	r
rrr
rrrr�
setuptoolsrZsetuptools.py31compatrrrcr,r1r(r(r(r)�<module>s@ 

?>