
    09oe                        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e          Z G d d          Z G 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 ZddZdS )ScanningLoaderc                 T    t          j        |            t                      | _        d S N)r   __init__set_visitedselfs    PD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/command/test.pyr   zScanningLoader.__init__   s"    D!!!    Nc                    || j         v rdS | j                             |           g }|                    t          j        | |                     t          |d          r'|                    |                                           t          |d          rt          |j        d          D ]}|	                    d          r|dk    r|j        dz   |dd         z   }n't          |j        |d	z             r|j        dz   |z   }nZ|                    |                     |                     t          |          d
k    r|                     |          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	submodules         r   r'   z"ScanningLoader.loadTestsFromModule   sf    T]""4&!!!Z3D&AABBB6-.. 	4LL00223336:&& 		@("== @ @=='' !DM,A,A &# 5SbS	 AII&v~8MNN !$*Oc$9D$@		 T33I>>????u::????5)))8Or   r   )r)   
__module____qualname__r   r'    r   r   r   r      s7               r   r   c                       e Zd Zd ZddZdS )NonDataPropertyc                     || _         d S r   fget)r   r:   s     r   r   zNonDataProperty.__init__C   s    			r   Nc                 4    || S |                      |          S r   r9   )r   objobjtypes      r   __get__zNonDataProperty.__get__F   s    ;Kyy~~r   r   )r)   r3   r4   r   r>   r5   r   r   r7   r7   B   s7               r   r7   c                       e Zd ZdZdZg dZd Zd Zed             Z	d Z
d Zej        g fd	            Zeej        d
                         Zed             Zd Zd Zed             Zee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                 >    d | _         d | _        d | _        d | _        d S r   )
test_suitetest_moduletest_loadertest_runnerr   s    r   initialize_optionsztest.initialize_options[   s'    r   c                 J   | j         r| j        rd}t          |          | j         (| j        | j        j         | _         n| j        dz   | _         | j        t          | j        dd           | _        | j        d| _        | j        t          | j        dd           | _        d S d S )Nz1You may specify a module or a suite, but not bothz.test_suiterG   z&setuptools.command.test:ScanningLoaderrH   )rE   rF   r   distributionrG   getattrrH   )r   msgs     r   finalize_optionsztest.finalize_optionsa   s    ? 	,t/ 	,EC&s+++?"'"&"3">"&"2]"B#&t'8-NND#GD#&t'8-NND $#r   c                 D    t          |                                           S r   )list
_test_argsr   s    r   	test_argsztest.test_argst   s    DOO%%&&&r   c              #   Z   K   | j         sdV  | j        rdV  | j         r| j         V  d S d S )Ndiscoverz	--verbose)rE   verboser   s    r   rQ   ztest._test_argsx   sZ       	< 	? 	"/!!!!!	" 	"r   c                 t    |                                  5   |             ddd           dS # 1 swxY w Y   dS )zI
        Backward compatibility for project_on_sys_path context.
        N)project_on_sys_path)r   funcs     r   with_project_on_sys_pathztest.with_project_on_sys_path   s     %%'' 	 	DFFF	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   -11c              #     K   |                      d           |                     dd           |                      d           |                     d          }t          j        d d          }t          j                                        }	 t          |j                  }t          j        	                    d|           t          j                     t          d            t          |j        d|j                   |                     |g          5  d V  d d d            n# 1 swxY w Y   |t          j        d d <   t          j                                         t          j                            |           t          j                     d S # |t          j        d d <   t          j                                         t          j                            |           t          j                     w xY w)Negg_info	build_extr$   )inplacer   c                 *    |                                  S r   )activate)dists    r   <lambda>z*test.project_on_sys_path.<locals>.<lambda>   s     r   z==)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_paths         r   rW   ztest.project_on_sys_path   s     $$$ 	!!+q!999%%%++J778AAA;k&&((	#)&/::LHOOA|,,, """#$@$@AAA1C1CDEEE))<.99                 #CHQQQKKK{+++ """"" #CHQQQKKK{+++ """"s2   BF D(F (D,,F /D,0F A#G9c              #   h  K   t                      }t          j                            d|          }t          j                            dd          }	 t          j                            t          |                     }t          d||g          }t          j                            |          }|r|t          j        d<   dV  ||u r"t          j                            dd           dS |t          j        d<   dS # ||u r!t          j                            dd           n|t          j        d<   w xY 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_paths          r   rm   ztest.paths_on_pythonpath   s      ((*..w??Z^^L"==	;Z___U%;%;<<FTF,>#?@@Gzw//H 4+3
<(EEE'))
|T22222+:
<((( '))
|T2222+:
<(::::s   A2C; ;6D1c                    |                      | j                  }|                      | j        pg           }|                      d | j                                        D                       }t          j        |||          S )z
        Install the requirements indicated by self.distribution and
        return an iterable of the dists that were built.
        c              3   x   K   | ]5\  }}|                     d           t          |dd                   1|V  6dS ):r$   N)
startswithr   ).0kvs      r   	<genexpr>z%test.install_dists.<locals>.<genexpr>   sf       %
 %
1||C  %
 &5QqrrU%;%;%
%
 %
 %
 %
 %
 %
r   )fetch_build_eggsinstall_requirestests_requireextras_requireitems	itertoolschain)r`   ir_dtr_der_ds       r   install_distsztest.install_dists   s     $$T%:;;$$T%7%=2>>$$ %
 %
+1133%
 %
 %
 
 

 tT4000r   c                 @   |                      dt          j                   |                     | j                  }d                    | j                  }| j        r|                      d|z             d S |                      d|z             t          t          j
        d          |          }|                     |          5  |                                 5  |                                  d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )NzWARNING: 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   rK   r|   _argvdry_runmapoperator
attrgetterrm   rW   	run_tests)r   installed_distscmdr   s       r   runztest.run   s    H	
 	
 	
 ,,T->??hhtz""< 	MM3c9:::Fns*+++H'
33_EE%%e,, 	! 	!))++ ! !   ! ! ! ! ! ! ! ! ! ! ! ! ! ! !	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	!s6   DC;/D;C?	?DC?	DDDc           	      H   t          j        d d | j        |                     | j                  |                     | j                  d          }|j                                        s9d|j        z  }|                     |t          j
                   t          |          d S )NF)
testLoader
testRunnerexitzTest failed: %s)unittestmainr   _resolve_as_eprG   rH   resultwasSuccessfulr   r   ERRORr   )r   r@   rM   s      r   r   ztest.run_tests   s    }J**4+;<<**4+;<<
 
 
 {((** 	&#dk1CMM#sy))) %%%	& 	&r   c                     dg| j         z   S )Nr   )rR   r   s    r   r   z
test._argv   s    |dn,,r   c                 d     t          j        | 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)vals    r   r   ztest._resolve_as_ep   s1     Lx"4tDDDIIKKMMMr   N)r)   r3   r4   __doc__descriptionuser_optionsrI   rN   r7   rR   rQ   rY   
contextlibcontextmanagerrW   staticmethodrm   r   r   r   propertyr   r   r   r5   r   r   r@   r@   L   sX       88DK  L     O O O& ' ' _'" " "   02 # # # #4 ; ;  \;0 1 1 \1! ! !.& & & - - X- N N Y \N N Nr   r@   )rx   r   re   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   r7   r@   r5   r   r   <module>r      s   				  



          A A A A A A A A                              " ! ! ! ! !       < < < < < < 8 8 8 8 8 8$ $ $ $ $Z $ $ $P       oN oN oN oN oN7 oN oN oN oN oNr   