관리-도구
편집 파일: test.cpython-39.opt-1.pyc
a �������f�$����������������������@���s����d�dl�Z�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlmZmZ�d�dl m Z �d�dlmZ�d�dlm Z mZmZmZmZmZmZmZmZ�d�dlmZ�ddlmZ�G�d d ��d e�ZG�dd��d�ZG�d d��de�ZdS�)�����N)�DistutilsError�DistutilsOptionError)�log)� TestLoader) �resource_listdir�resource_exists�normalize_path�working_set�_namespace_packages�evaluate_marker�add_activation_listener�require� EntryPoint)�Command����)�_unique_everseenc�������������������@���s���e�Zd�Zdd��Zddd�ZdS�)�ScanningLoaderc�����������������C���s���t��|���t��|�_d�S��N)r����__init__�set�_visited��self��r����;/usr/lib/python3.9/site-packages/setuptools/command/test.pyr������s���� zScanningLoader.__init__Nc�����������������C���s����||�j�v�rdS�|�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�|d�S�dS�)a��Return 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__.pyr���r���)r����add�appendr����loadTestsFromModule�hasattrr���r����__name__�endswithr���ZloadTestsFromName�lenZ suiteClass)r����module�patternZtests�fileZ submoduler���r���r���r"������s$���� z"ScanningLoader.loadTestsFromModule)N)r$���� __module__�__qualname__r���r"���r���r���r���r���r������s���r���c�������������������@���s���e�Zd�Zdd��Zddd�ZdS�)�NonDataPropertyc�����������������C���s ���||�_�d�S�r�����fget)r���r.���r���r���r���r���<���s����zNonDataProperty.__init__Nc�����������������C���s���|d�u�r|�S�|���|�S�r���r-���)r����objZobjtyper���r���r����__get__?���s����zNonDataProperty.__get__)N)r$���r*���r+���r���r0���r���r���r���r���r,���;���s���r,���c�������������������@���s����e�Zd�ZdZdZg�d�Zdd��Zdd��Zedd ���Z d d��Z dd ��Zej g�fdd��Zeej dd����Zedd���Zdd��Zdd��Zedd���Zedd���ZdS�)�testz.Command to run unit tests after in-place buildz0run unit tests after in-place build (deprecated)))ztest-module=�mz$Run 'test_suite' in specified module)ztest-suite=�sz9Run single test, case or suite (e.g. 'module.test_suite'))ztest-runner=�rzTest runner to usec�����������������C���s���d�|�_�d�|�_d�|�_d�|�_d�S�r���)� test_suite�test_module�test_loader�test_runnerr���r���r���r����initialize_optionsQ���s����ztest.initialize_optionsc�����������������C���s����|�j�r|�jrd}t|��|�j�d�u�rD|�jd�u�r8|�jj�|�_�n|�jd�|�_�|�jd�u�r^t|�jdd��|�_|�jd�u�rnd|�_|�jd�u�r�t|�jdd��|�_d�S�)Nz1You may specify a module or a suite, but not bothz.test_suiter7���z&setuptools.command.test:ScanningLoaderr8���)r5���r6���r����distributionr7����getattrr8���)r����msgr���r���r����finalize_optionsW���s���� ztest.finalize_optionsc�����������������C���s���t�|�����S�r���)�list� _test_argsr���r���r���r���� test_argsj���s����ztest.test_argsc�����������������c���s4���|�j�stjdkrdV��|�jr"dV��|�j�r0|�j�V��d�S�)N)��������Zdiscoverz --verbose)r5����sys�version_info�verboser���r���r���r���r?���n���s����ztest._test_argsc�����������������C���s2���|�������|���W�d����n1�s$0����Y��dS�)zI Backward compatibility for project_on_sys_path context. N)�project_on_sys_path)r����funcr���r���r����with_project_on_sys_pathv���s���� ztest.with_project_on_sys_pathc����������� ��� ���c���s���t�|�jdd�}|rp|�jddd��|��d��|��d�}t|j�}|�jd|d��|��d��|�jddd��|��d��n"|��d��|�jdd d��|��d��|��d�}tjd�d���}tj � ��}z�t|j�}tj�d|��t ����td d����td|j|jf���|��|g���d�V��W�d�����n1��s 0����Y��W�|tjd�d��<�tj ����tj �|��t ����n.|tjd�d��<�tj ����tj �|��t ����0�d�S�) N�use_2to3F�build_pyr���)ZinplaceZegg_info)�egg_baseZ build_extr���c�����������������S���s���|�����S�r���)Zactivate)�distr���r���r����<lambda>���������z*test.project_on_sys_path.<locals>.<lambda>z%s==%s)r;���r:���Zreinitialize_commandZrun_commandZget_finalized_commandr���Z build_librC����path�modules�copyrK����insertr ���r���r���r ���Zegg_nameZegg_version�paths_on_pythonpath�clear�update) r���Z include_distsZ with_2to3Zbpy_cmdZ build_pathZei_cmdZold_pathZold_modulesZproject_pathr���r���r���rF���}���s@���� ( � ztest.project_on_sys_pathc�������������� ���c���s����t���}tj�d|�}tj�dd�}zdtj�t|���}td||g�}tj�|�}|r\|tjd<�dV��W�||u�r|tj�dd��q�|tjd<�n$||u�r�tj�dd��n |tjd<�0�dS�)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�pathsep�joinr����filter�pop)�pathsZnothingZorig_pythonpathZcurrent_pythonpath�prefixZto_join�new_pathr���r���r���rS�������s ���� �ztest.paths_on_pythonpathc�����������������C���sD���|���|�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. c�����������������s���s0���|�](\}}|��d��rt|dd���r|V��qdS�)�:r���N)� startswithr���)�.0�k�vr���r���r���� <genexpr>����s����z%test.install_dists.<locals>.<genexpr>)Zfetch_build_eggsZinstall_requiresZ tests_requireZextras_require�items� itertools�chain)rL���Zir_dZtr_dZer_dr���r���r���� install_dists����s���� �ztest.install_distsc�������������� ���C���s����|���dtj��|��|�j�}d�|�j�}|�jr>|���d|���d�S�|���d|���tt � d�|�}|��|��@�|������|�� ���W�d�����n1�s�0����Y��W�d�����n1�s�0����Y��d�S�)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)zrunning "%s"�location)�announcer���ZWARNrj���r:���r[����_argv�dry_run�map�operator� attrgetterrS���rF���� run_tests)r���Zinstalled_dists�cmdr^���r���r���r����run����s����� ztest.runc�����������������C���s����t�|�jdd�rx|�j�d�d�}|tv�rxg�}|tjv�r>|�|��|d7�}tjD�]}|�|�rL|�|��qLt t tjj|���tj d�d�|�j|��|�j�|��|�j�dd�}|j���s�d|j�}|��|tj��t|��d�S�)NrI���Fr���r���)Z testLoaderZ testRunner�exitzTest failed: %s)r;���r:���r5����splitr ���rC���rP���r!���rb���r>���rp����__delitem__�unittest�mainrn����_resolve_as_epr7���r8����resultZ wasSuccessfulrm���r���ZERRORr���)r���r'���Zdel_modules�namer1���r<���r���r���r���rs�������s*���� � ztest.run_testsc�����������������C���s���dg|�j��S�)Nry���)r@���r���r���r���r���rn�����s����z test._argvc�����������������C���s$���|�du�rdS�t��d|���}|�����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)r$���r*���r+����__doc__�descriptionZuser_optionsr9���r=���r,���r@���r?���rH���� contextlib�contextmanagerrF����staticmethodrS���rj���ru���rs����propertyrn���r{���r���r���r���r���r1���E���s,��� - r1���)rW���rq���rC���r����rh���ry���Zdistutils.errorsr���r���Z distutilsr���r���Z pkg_resourcesr���r���r���r ���r ���r���r���r ���r���Z setuptoolsr���rJ���r���r���r,���r1���r���r���r���r����<module>���s���,)