Your IP : 3.22.68.228


Current Path : /opt/alt/python36/lib/python3.6/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/setuptools/command/__pycache__/test.cpython-36.pyc

3

K�Re�#�@s�ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddlm
Z
ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZGd	d
�d
e�ZGdd�de�ZGd
d�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)�Commandc@seZdZdd�Zddd�ZdS)�ScanningLoadercCstj|�t�|_dS)N)r�__init__�set�_visited)�self�r��/builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/command/test.pyrs
zScanningLoader.__init__NcCs�||jkrdS|jj|�g}|jtj||��t|d�rH|j|j��t|d�r�xpt|jd�D]`}|j	d�r�|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.
        N�additional_tests�__path__�z.pyz__init__.py�.�z/__init__.py�r���)r�add�appendr�loadTestsFromModule�hasattrrr	�__name__�endswithr
ZloadTestsFromName�lenZ
suiteClass)r�module�pattern�tests�file�	submodulerrrr#s$



z"ScanningLoader.loadTestsFromModule)N)r%�
__module__�__qualname__rr#rrrrrsrc@seZdZdd�Zddd�ZdS)�NonDataPropertycCs
||_dS)N)�fget)rr0rrrr>szNonDataProperty.__init__NcCs|dkr|S|j|�S)N)r0)r�objZobjtyperrr�__get__AszNonDataProperty.__get__)N)r%r-r.rr2rrrrr/=sr/c@s�eZdZdZdZd%d&d'gZdd
�Zdd�Zedd��Z	dd�Z
dd�Zej
gfdd��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 usecCsd|_d|_d|_d|_dS)N)�
test_suite�test_module�test_loader�test_runner)rrrr�initialize_optionsSsztest.initialize_optionscCs�|jr|jrd}t|��|jdkrD|jdkr8|jj|_n|jd|_|jdkr^t|jdd�|_|jdkrnd|_|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�msgrrr�finalize_optionsYs




ztest.finalize_optionscCst|j��S)N)�list�
_test_args)rrrr�	test_argslsztest.test_argsccs6|jrtjdkrdV|jr$dV|jr2|jVdS)N��Zdiscoverz	--verbose)rIrJ)r=�sys�version_info�verbose)rrrrrGpsztest._test_argsc	Cs|j��|�WdQRXdS)zI
        Backward compatibility for project_on_sys_path context.
        N)�project_on_sys_path)r�funcrrr�with_project_on_sys_pathxs
ztest.with_project_on_sys_pathc	csPtjot|jdd�}|rv|jddd�|jd�|jd�}t|j�}|jd|d�|jd�|jddd�|jd�n"|jd�|jdd	d�|jd�|jd�}t	j
dd�}t	jj�}zbt|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_pyr)Zinplace�egg_info)�egg_base�	build_extrcSs|j�S)N)�activate)�distrrr�<lambda>�sz*test.project_on_sys_path.<locals>.<lambda>z%s==%s)r�PY3rCrB�reinitialize_command�run_command�get_finalized_commandr�	build_librK�path�modules�copyrT�insertrrrr�egg_nameZegg_version�paths_on_pythonpath�clear�update)	rZ
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmd�old_pathZold_modulesZproject_pathrrrrNs8









ztest.project_on_sys_pathccs�t�}tjjd|�}tjjdd�}z>tjj|�}td||g�}tjj|�}|rX|tjd<dVWd||krztjjdd�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_pathrrrrc�s


ztest.paths_on_pythonpathcCsD|j|j�}|j|jpg�}|jdd�|jj�D��}tj|||�S)z�
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        css0|](\}}|jd�rt|dd��r|VqdS)�:rN)�
startswithr)�.0�k�vrrr�	<genexpr>�sz%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ
tests_requireZextras_require�items�	itertools�chain)rWZir_dZtr_dZer_drrr�
install_dists�s
ztest.install_distscCs�|j|j�}dj|j�}|jr0|jd|�dS|jd|�ttjd�|�}|j	|��"|j
��|j�WdQRXWdQRXdS)N� zskipping "%s" (dry run)zrunning "%s"�location)r{rBrm�_argv�dry_run�announcer�operator�
attrgetterrcrN�	run_tests)rZinstalled_dists�cmdrorrr�run�s
ztest.runcCs�tjr�t|jdd�r�|jjd�d}|tkr�g}|tjkrD|j	|�|d7}x"tjD]}|j
|�rT|j	|�qTWtttjj
|��tjdd|j|j|j�|j|j�dd�}|jj�s�d|j}|j|tj�t|��dS)NrQFrr)Z
testLoaderZ
testRunner�exitzTest failed: %s)rrYrCrBr=�splitr
rKr_r"rsrFr�__delitem__�unittest�mainr~�_resolve_as_epr?r@�resultZ
wasSuccessfulr�r�ERRORr)rr(Zdel_modules�namer3rDrrrr��s(






ztest.run_testscCsdg|jS)Nr�)rH)rrrrr~�sz
test._argvcCs$|dkrdStjd|�}|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�parsedrrrr�sztest._resolve_as_epN)r4r5r6)r7r8r9)r:r;r<)r%r-r.�__doc__�description�user_optionsrArEr/rHrGrP�
contextlib�contextmanagerrN�staticmethodrcr{r�r��propertyr~r�rrrrr3Gs(-r3)!rir�rKr�ryr��distutils.errorsrr�	distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrr�
pkg_resourcesr	r
rrr
rrrr�
setuptoolsrrrhr/r3rrrr�<module>s,)

?>