o
    OBi¥  ã                   @   sÞ   d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZmZ d dl	m
Z
 d dlmZ d dlmZmZmZmZmZmZmZ ddlmZ d dlmZ d d	lmZ d d
lmZ G dd„ deƒZG dd„ dƒZG dd„ deƒZdS )é    N)ÚDistutilsErrorÚDistutilsOptionError)Úlog)Ú
TestLoader)Úresource_listdirÚresource_existsÚnormalize_pathÚworking_setÚevaluate_markerÚadd_activation_listenerÚrequireé   )Úmetadata)ÚCommand)Úunique_everseen)Ú	pass_nonec                   @   ó   e Zd Zdd„ Zddd„ZdS )ÚScanningLoaderc                 C   s   t  | ¡ tƒ | _d S ©N)r   Ú__init__ÚsetÚ_visited©Úself© r   úf/var/www/html/Moveonwheels/move_on_wheels/venv/lib/python3.10/site-packages/setuptools/command/test.pyr      s   
zScanningLoader.__init__Nc                 C   sÞ   || j v rdS | j  |¡ g }| t | |¡¡ t|dƒr$| | ¡ ¡ t|dƒr`t|jdƒD ]0}| 	d¡rF|dkrF|jd |dd…  }nt
|j|d	 ƒrV|jd | }nq/| |  |¡¡ q/t|ƒd
krk|  |¡S |d S )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__.pyé   r   )r   ÚaddÚappendr   ÚloadTestsFromModuleÚhasattrr   r   Ú__name__Úendswithr   ÚloadTestsFromNameÚlenÚ
suiteClass)r   ÚmoduleÚpatternÚtestsÚfileÚ	submoduler   r   r   r$      s$   



z"ScanningLoader.loadTestsFromModuler   )r&   Ú
__module__Ú__qualname__r   r$   r   r   r   r   r      s    r   c                   @   r   )ÚNonDataPropertyc                 C   s
   || _ d S r   ©Úfget)r   r4   r   r   r   r   C   s   
zNonDataProperty.__init__Nc                 C   s   |d u r| S |   |¡S r   r3   )r   ÚobjÚobjtyper   r   r   Ú__get__F   s   
zNonDataProperty.__get__r   )r&   r0   r1   r   r7   r   r   r   r   r2   B   s    r2   c                   @   s¢   e Zd ZdZdZg d¢Zdd„ Zdd„ Zedd	„ ƒZ	d
d„ Z
dd„ Zejddd„ƒZeejdd„ ƒƒZedd„ ƒZdd„ Zdd„ Zedd„ ƒZeedd„ ƒƒZdS )Ú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)ztest-suite=Úsz9Run single test, case or suite (e.g. 'module.test_suite'))ztest-runner=ÚrzTest runner to usec                 C   s   d | _ d | _d | _d | _d S r   )Ú
test_suiteÚtest_moduleÚtest_loaderÚtest_runnerr   r   r   r   Úinitialize_options[   s   
ztest.initialize_optionsc                 C   s�   | j r| jrd}t|ƒ‚| j d u r"| jd u r| jj | _ n| jd | _ | jd u r/t| jdd ƒ| _| jd u r7d| _| jd u rFt| jdd ƒ| _d S d S )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_optionsa   s   




ÿztest.finalize_optionsc                 C   s   t |  ¡ ƒS r   )ÚlistÚ
_test_argsr   r   r   r   Ú	test_argss   ó   ztest.test_argsc                 c   s0   � | j sdV  | jrdV  | j r| j V  d S d S )NÚdiscoverz	--verbose)r<   Úverboser   r   r   r   rF   w   s   €ÿztest._test_argsc                 C   s4   |   ¡ � |ƒ  W d  ƒ dS 1 sw   Y  dS )zI
        Backward compatibility for project_on_sys_path context.
        N)Úproject_on_sys_path)r   Úfuncr   r   r   Úwith_project_on_sys_path   s   
"ÿztest.with_project_on_sys_pathr   c              
   c   sL  � |   d¡ | jddd� |   d¡ |  d¡}tjd d … }tj ¡ }zkt|jƒ}tj 	d|¡ t
 ¡  tdd„ ƒ td|j|jf ƒ |  |g¡� d V  W d   ƒ n!1 sXw   Y  W |tjd d …< tj ¡  tj |¡ t
 ¡  d S W |tjd d …< tj ¡  tj |¡ t
 ¡  d S |tjd d …< tj ¡  tj |¡ t
 ¡  w )	NÚegg_infoÚ	build_extr!   )Úinplacer   c                 S   s   |   ¡ S r   )Úactivate)Údistr   r   r   Ú<lambda>—   s    z*test.project_on_sys_path.<locals>.<lambda>z%s==%s)Úrun_commandÚreinitialize_commandÚget_finalized_commandÚsysÚpathÚmodulesÚcopyr   Úegg_baseÚinsertr	   r   r   r   Úegg_nameÚegg_versionÚpaths_on_pythonpathÚclearÚupdate)r   Úinclude_distsÚei_cmdÚold_pathÚold_modulesÚproject_pathr   r   r   rK   †   s:   €




ÿ
ú
ý

ztest.project_on_sys_pathc              
   c   s²   � t ƒ }tj d|¡}tj dd¡}z4tj t| ƒ¡}td||gƒ}tj |¡}|r/|tjd< dV  W ||u r@tj dd¡ dS |tjd< dS ||u rStj dd¡ w |tjd< w )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.
        Ú
PYTHONPATHr   N)	ÚobjectÚosÚenvironÚgetÚpathsepÚjoinr   ÚfilterÚpop)ÚpathsÚnothingÚorig_pythonpathÚcurrent_pythonpathÚprefixÚto_joinÚnew_pathr   r   r   r_   ¡   s"   €

ýztest.paths_on_pythonpathc                 C   sD   |   | j¡}|   | jpg ¡}|   dd„ | j ¡ D ƒ¡}t |||¡S )z†
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        c                 s   s2   � | ]\}}|  d ¡rt|dd… ƒr|V  qdS )ú:r!   N)Ú
startswithr
   )Ú.0ÚkÚvr   r   r   Ú	<genexpr>Ã   s   € ýý
ÿz%test.install_dists.<locals>.<genexpr>)Úfetch_build_eggsÚinstall_requiresÚtests_requireÚextras_requireÚitemsÚ	itertoolsÚchain)rR   Úir_dÚtr_dÚer_dr   r   r   Úinstall_dists»   s   
þztest.install_distsc              	   C   sÌ   |   dtj¡ |  | j¡}d | j¡}| jr|   d| ¡ d S |   d| ¡ tt	 
d¡|ƒ}|  |¡�) |  ¡ � |  ¡  W d   ƒ n1 sGw   Y  W d   ƒ d S W d   ƒ d S 1 s_w   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.ú zskipping "%s" (dry run)zrunning "%s"Úlocation)Úannouncer   ÚWARNr‡   rA   rm   Ú_argvÚdry_runÚmapÚoperatorÚ
attrgetterr_   rK   Ú	run_tests)r   Úinstalled_distsÚcmdrp   r   r   r   ÚrunÊ   s$   û

ÿÿ"ÿztest.runc                 C   sV   t jd d | j|  | j¡|  | j¡dd�}|j ¡ s)d|j }|  |t	j
¡ t|ƒ‚d S )NF)Ú
testLoaderÚ
testRunnerÚexitzTest failed: %s)ÚunittestÚmainrŒ   Ú_resolve_as_epr>   r?   ÚresultÚwasSuccessfulrŠ   r   ÚERRORr   )r   r8   rC   r   r   r   r‘   á   s   

ú

ýztest.run_testsc                 C   s   dg| j  S )Nr˜   )rG   r   r   r   r   rŒ   ï   rH   z
test._argvc                 C   s   t j| ddd� ¡ ƒ S )zu
        Load the indicated attribute value, called, as a as if it were
        specified as an entry point.
        N)ÚvalueÚnameÚgroup)r   Ú
EntryPointÚload)Úvalr   r   r   rš   ó   s   ztest._resolve_as_epN)r   )r&   r0   r1   Ú__doc__ÚdescriptionÚuser_optionsr@   rD   r2   rG   rF   rM   Ú
contextlibÚcontextmanagerrK   Ústaticmethodr_   r‡   r”   r‘   ÚpropertyrŒ   r   rš   r   r   r   r   r8   L   s0    



r8   )ri   r�   rW   r§   r‚   r˜   Údistutils.errorsr   r   Ú	distutilsr   r   Úpkg_resourcesr   r   r   r	   r
   r   r   Ú
_importlibr   Ú
setuptoolsr   Ú setuptools.extern.more_itertoolsr   Ú"setuptools.extern.jaraco.functoolsr   r   r2   r8   r   r   r   r   Ú<module>   s"    $	(
