Hacked By AnonymousFox

Current Path : /lib/python3.8/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/command/__pycache__/test.cpython-38.pyc

U

�Qab�%�@s�ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZddlm
Z
ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZd	d
lmZeZ Gdd�de�Z!Gd
d�d�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�)�_unique_everseenc@seZdZdd�Zddd�ZdS)�ScanningLoadercCst�|�t�|_dS�N)r�__init__�set�_visited��self�r�;/usr/lib/python3.8/site-packages/setuptools/command/test.pyrs
zScanningLoader.__init__NcCs�||jkrdS|j�|�g}|�t�||��t|d�rH|�|���t|d�r�t|jd�D]`}|�	d�r�|dkr�|jd|dd�}n"t
|j|d	�r^|jd|}nq^|�|�|��q^t|�d
kr�|�
|�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__.pyrr)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
||_dSr��fget)rr1rrrrAszNonDataProperty.__init__NcCs|dkr|S|�|�Srr0)r�objZobjtyperrr�__get__DszNonDataProperty.__get__)N)r'r-r.rr3rrrrr/@sr/c@s�eZdZdZdZdddgZdd�Zdd	�Zed
d��Z	dd
�Z
dd�Zej
gfdd��Zeej
dd���Zedd��Zdd�Zdd�Zedd��Zedd��ZdS)�testz.Command to run unit tests after in-place buildz0run unit tests after in-place build (deprecated))ztest-module=�mz$Run 'test_suite' in specified module)ztest-suite=�sz9Run single test, case or suite (e.g. 'module.test_suite'))ztest-runner=�rzTest runner to usecCsd|_d|_d|_d|_dSr)�
test_suite�test_module�test_loader�test_runnerrrrr�initialize_optionsVsztest.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;)r8r9r�distributionr:�getattrr;)r�msgrrr�finalize_options\s




ztest.finalize_optionscCst|���Sr)�list�
_test_argsrrrr�	test_argsosztest.test_argsccs4|jstjdkrdV|jr"dV|jr0|jVdS)N)��Zdiscoverz	--verbose)r8�sys�version_info�verboserrrrrBssztest._test_argsc	Cs|���|�W5QRXdS)zI
        Backward compatibility for project_on_sys_path context.
        N)�project_on_sys_path)r�funcrrr�with_project_on_sys_path{s
ztest.with_project_on_sys_pathc	
csPtjot|jdd�}|rv|jddd�|�d�|�d�}t|j�}|jd|d�|�d�|jddd�|�d�n"|�d�|jdd	d�|�d�|�d�}t	j
dd�}t	j��}zbt|j�}t	j
�d|�t��td
d��td|j|jf�|�|g��dVW5QRXW5|t	j
dd�<t	j�
�t	j�|�t��XdS)
N�use_2to3F�build_pyr)ZinplaceZegg_info)�egg_baseZ	build_extrcSs|��Sr)Zactivate)�distrrr�<lambda>��z*test.project_on_sys_path.<locals>.<lambda>z%s==%s)r�PY3r>r=Zreinitialize_commandZrun_commandZget_finalized_commandrZ	build_librF�path�modules�copy�clear�updaterrrN�insertrrZegg_nameZegg_version�paths_on_pythonpath)	rZ
include_distsZ	with_2to3Zbpy_cmdZ
build_pathZei_cmdZold_pathZold_modulesZproject_pathrrrrI�s8









ztest.project_on_sys_pathc
cs�t�}tj�d|�}tj�dd�}zBtj�t|��}td||g�}tj�|�}|r\|tjd<dVW5||kr~tj�dd�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.
        Z
PYTHONPATHr N)	�object�os�environ�get�pop�pathsep�joinrr)�pathsZnothingZorig_pythonpathZcurrent_pythonpath�prefixZto_join�new_pathrrrrY�s


ztest.paths_on_pythonpathcCsD|�|j�}|�|jpg�}|�dd�|j��D��}t�|||�S)z�
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        css0|](\}}|�d�rt|dd��r|VqdS)�:rN)�
startswithr)�.0�k�vrrr�	<genexpr>�s
�z%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ
tests_requireZextras_require�items�	itertools�chain)rOZir_dZtr_dZer_drrr�
install_dists�s
�ztest.install_distsc
Cs�|�dtj�|�|j�}d�|j�}|jr>|�d|�dS|�d|�tt	�
d�|�}|�|��"|���|�
�W5QRXW5QRXdS)Nz�WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.� zskipping "%s" (dry run)zrunning "%s"�location)�announcerZWARNrmr=r`�_argvZdry_runr�operator�
attrgetterrYrI�	run_tests)rZinstalled_dists�cmdrarrr�run�s�
ztest.runcCs�tjr~t|jdd�r~|j�d�d}|tkr~g}|tjkrD|�	|�|d7}tjD]}|�
|�rR|�	|�qRtttjj
|��tjdd|j|�|j�|�|j�dd�}|j��s�d|j}|�|tj�t|��dS)NrLFr!r)Z
testLoaderZ
testRunner�exitzTest failed: %s)rrRr>r=r8�splitr
rFrTr$rerAr�__delitem__�unittest�mainrq�_resolve_as_epr:r;�resultZ
wasSuccessfulrprZERRORr)rr*Zdel_modules�namer4r?rrrrt�s.





�

ztest.run_testscCsdg|jS)Nrz)rCrrrrrq
sz
test._argvcCs$|dkrdSt�d|�}|���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)r'r-r.�__doc__�descriptionZuser_optionsr<r@r/rCrBrK�
contextlib�contextmanagerrI�staticmethodrYrmrvrt�propertyrqr|rrrrr4Js2�
-


r4)$r[rrrFr�rkrzZdistutils.errorsrrZ	distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrZ
pkg_resourcesr	r
rrr
rrrrZ
setuptoolsrrMr�typeZ
__metaclass__rr/r4rrrr�<module>s",)

Hacked By AnonymousFox1.0, Coded By AnonymousFox