ok

Mini Shell

Direktori : /lib/python3.6/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/setuptools/command/__pycache__/test.cpython-36.pyc

3

9��f�#�@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�/usr/lib/python3.6/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�patternZtests�fileZ	submodulerrrr#s$



z"ScanningLoader.loadTestsFromModule)N)r%�
__module__�__qualname__rr#rrrrrsrc@seZdZdd�Zddd�ZdS)�NonDataPropertycCs
||_dS)N)�fget)rr.rrrr>szNonDataProperty.__init__NcCs|dkr|S|j|�S)N)r.)r�objZobjtyperrr�__get__AszNonDataProperty.__get__)N)r%r+r,rr0rrrrr-=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)rGrH)r;�sys�version_info�verbose)rrrrrEps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_2to3FZbuild_pyr)ZinplaceZegg_info)�egg_baseZ	build_extrcSs|j�S)N)Zactivate)�distrrr�<lambda>�sz*test.project_on_sys_path.<locals>.<lambda>z%s==%s)r�PY3rAr@Zreinitialize_commandZrun_commandZget_finalized_commandrZ	build_librI�path�modules�copyrP�insertrrrrZegg_nameZegg_version�paths_on_pythonpath�clear�update)	rZ
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmdZold_pathZold_modulesZproject_pathrrrrLs8









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_pathrrrrX�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)rQZir_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)ror@ra�_argvZdry_run�announcer�operator�
attrgetterrXrL�	run_tests)rZinstalled_dists�cmdrcrrr�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)NrOFrr)Z
testLoaderZ
testRunner�exitzTest failed: %s)rrSrAr@r;�splitr
rIrUr"rgrDr�__delitem__�unittest�mainrr�_resolve_as_epr=r>�resultZ
wasSuccessfulrsrZERRORr)rr(Zdel_modules�namer1rBrrrrv�s(






ztest.run_testscCsdg|jS)Nr|)rF)rrrrrr�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�parseZresolve)�valZparsedrrrr~sztest._resolve_as_epN)r2r3r4)r5r6r7)r8r9r:)r%r+r,�__doc__�descriptionZuser_optionsr?rCr-rFrErN�
contextlib�contextmanagerrL�staticmethodrXrorxrv�propertyrrr~rrrrr1Gs(-r1)!r]rtrIr�rmr|Zdistutils.errorsrrZ	distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesr	r
rrr
rrrrZ
setuptoolsrrr\r-r1rrrr�<module>s,)

Zerion Mini Shell 1.0