3 K”Reþ#ã@sàddlZddlZddlZddlZddlZddlZddlmZmZddl m Z ddlm Z ddl m Z ddlmZmZddlmZmZmZmZmZmZmZmZmZddlmZGd d „d e ƒZGd d „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ú�/builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/command/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|d SdS) 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ÚpatternÚtestsÚfileÚ submodulerrrr#s$      z"ScanningLoader.loadTestsFromModule)N)r%Ú __module__Ú __qualname__rr#rrrrrsrc@seZdZdd„Zddd„ZdS)ÚNonDataPropertycCs ||_dS)N)Úfget)rr0rrrr>szNonDataProperty.__init__NcCs|dkr |S|j|ƒS)N)r0)rÚobjZobjtyperrrÚ__get__AszNonDataProperty.__get__)N)r%r-r.rr2rrrrr/=sr/c@s¢eZdZdZdZd%d&d'gZd d „Zdd„Zedd„ƒZ dd„Z dd„Z e 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)rIrJ)r=ÚsysÚ version_infoÚverbose)rrrrrGps 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 j j ƒ}zbt|j ƒ}t j jd|ƒtjƒtd d „ƒtd |j|jfƒ|j|gƒ� dVWdQRXWd|t j dd…<t j jƒt j j|ƒtjƒXdS) NÚuse_2to3FÚbuild_pyr)ZinplaceÚegg_info)Úegg_baseÚ build_extrcSs|jƒS)N)Úactivate)ÚdistrrrÚ£sz*test.project_on_sys_path..z%s==%s)rÚPY3rCrBÚreinitialize_commandÚ run_commandÚget_finalized_commandr Ú build_librKÚpathÚmodulesÚcopyrTÚinsertr rrrÚegg_nameZ egg_versionÚpaths_on_pythonpathÚclearÚupdate) rZ include_distsZ with_2to3Zbpy_cmdZ build_pathZei_cmdÚold_pathZ old_modulesZ project_pathrrrrNs8             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_pathrrrrc­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ú Ðsz%test.install_dists..)Zfetch_build_eggsZinstall_requiresZ tests_requireZextras_requireÚitemsÚ itertoolsÚchain)rWZir_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) r{rBrmÚ_argvÚdry_runÚannouncerÚoperatorÚ attrgetterrcrNÚ run_tests)rZinstalled_distsÚcmdrorrrÚrunÕs    ztest.runcCsØtjr‚t|jddƒr‚|jjdƒd}|tkr‚g}|tjkrD|j |ƒ|d7}x"tjD]}|j |ƒrT|j |ƒqTWt t tjj |ƒƒtjdd|j|j|jƒ|j|jƒdd�}|jjƒsÔd|j}|j|tjƒt|ƒ‚dS)NrQFrr)Z testLoaderZ testRunnerÚexitzTest failed: %s)rrYrCrBr=Úsplitr rKr_r"rsrFrÚ __delitem__ÚunittestÚmainr~Ú_resolve_as_epr?r@ÚresultZ wasSuccessfulr€rÚERRORr)rr(Z del_modulesÚnamer3rDrrrrƒäs(        ztest.run_testscCs dg|jS)Nr‰)rH)rrrrr~ÿ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ÚparseÚresolve)ÚvalÚparsedrrrr‹sztest._resolve_as_epN)r4r5r6)r7r8r9)r:r;r<)r%r-r.Ú__doc__Ú descriptionÚ user_optionsrArEr/rHrGrPÚ contextlibÚcontextmanagerrNÚ staticmethodrcr{r…rƒÚpropertyr~r‹rrrrr3Gs( -  r3)!rir�rKr–ryr‰Údistutils.errorsrrÚ distutilsrrZsetuptools.externrZsetuptools.extern.six.movesrrÚ pkg_resourcesr r r r r rrrrÚ setuptoolsrrrhr/r3rrrrÚs   , )