B Re@sddlZddlZddlZddlZddlZddlZddlmZmZddl m Z ddlm Z ddl m Z mZmZmZmZmZmZmZddlmZddlmZGdd d e ZGd d d ZGd d d eZdS)N)DistutilsErrorDistutilsOptionError)log) TestLoader)resource_listdirresource_existsnormalize_path working_setevaluate_markeradd_activation_listenerrequire EntryPoint)Command)unique_everseenc@seZdZddZdddZdS)ScanningLoadercCst|t|_dS)N)r__init__set_visited)selfr/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/command/test.pyrs zScanningLoader.__init__NcCs||jkrdS|j|g}|t||t|drH||t|drxpt|jdD]`}| dr|dkr|jd|dd}n"t |j|d r`|jd|}nq`|| |q`Wt |d kr| |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. Nadditional_tests__path__z.pyz __init__.py.z /__init__.pyr)raddappendrloadTestsFromModulehasattrrr__name__endswithrZloadTestsFromNamelenZ suiteClass)rmodulepatterntestsfile submodulerrrrs$      z"ScanningLoader.loadTestsFromModule)N)r! __module__ __qualname__rrrrrrrsrc@seZdZddZdddZdS)NonDataPropertycCs ||_dS)N)fget)rr,rrrrBszNonDataProperty.__init__NcCs|dkr |S||S)N)r,)robjZobjtyperrr__get__EszNonDataProperty.__get__)N)r!r)r*rr.rrrrr+Asr+c@seZdZdZdZdddgZddZdd Zed d Z d d Z ddZ e j gfddZee j ddZeddZddZddZeddZeddZdS)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=rzTest runner to usecCsd|_d|_d|_d|_dS)N) test_suite test_module test_loader test_runner)rrrrinitialize_optionsZsztest.initialize_optionscCs|jr|jrd}t||jdkrD|jdkr8|jj|_n |jd|_|jdkr^t|jdd|_|jdkrnd|_|jdkrt|jdd|_dS)Nz1You may specify a module or a suite, but not bothz .test_suiter5z&setuptools.command.test:ScanningLoaderr6)r3r4r distributionr5getattrr6)rmsgrrrfinalize_options`s        ztest.finalize_optionscCs t|S)N)list _test_args)rrrr test_argsssztest.test_argsccs4|jstjdkrdV|jr"dV|jr0|jVdS)N)Zdiscoverz --verbose)r3sys version_infoverbose)rrrrr=ws ztest._test_argsc Cs| |WdQRXdS)zI Backward compatibility for project_on_sys_path context. N)project_on_sys_path)rfuncrrrwith_project_on_sys_paths ztest.with_project_on_sys_pathc cs|d|jddd|d|d}tjdd}tj}zbt|j}tj d|t t ddt d|j|jf||g dVWdQRXWd|tjdd<tjtj|t XdS) Negg_info build_extr)ZinplacercSs|S)N)activate)distrrrz*test.project_on_sys_path..z%s==%s) run_commandreinitialize_commandget_finalized_commandrApathmodulescopyrZegg_baseinsertr rr r egg_nameZ egg_versionpaths_on_pythonpathclearupdate)rZ include_distsZei_cmdold_pathZ old_modulesZ project_pathrrrrDs$        ztest.project_on_sys_pathc cst}tjd|}tjdd}zBtjt|}td||g}tj|}|r\|tjd<dVWd||kr~tjddn |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) objectosenvirongetpathsepjoinrfilterpop)pathsZnothingZorig_pythonpathZcurrent_pythonpathprefixZto_joinnew_pathrrrrUs    ztest.paths_on_pythonpathcCsD||j}||jpg}|dd|jD}t|||S)z Install the requirements indicated by self.distribution and return an iterable of the dists that were built. css0|](\}}|drt|ddr|VqdS):rN) startswithr ).0kvrrr sz%test.install_dists..)Zfetch_build_eggsZinstall_requiresZ tests_requireZextras_requireitems itertoolschain)rJZir_dZtr_dZer_drrr install_distss  ztest.install_distsc Cs|dtj||j}d|j}|jr>|d|dS|d|tt d|}| |"| | WdQRXWdQRXdS)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. zskipping "%s" (dry run)z running "%s"location)announcerWARNrnr8r__argvdry_runmapoperator attrgetterrUrD run_tests)rZinstalled_distscmdrbrrrruns    ztest.runcCsVtjdd|j||j||jdd}|jsRd|j}||t j t |dS)NF)Z testLoaderZ testRunnerexitzTest failed: %s) unittestmainrs_resolve_as_epr5r6resultZ wasSuccessfulrqrERRORr)rr/r:rrrrxs    ztest.run_testscCs dg|jS)Nr|)r>)rrrrrssz test._argvcCs$|dkr dStd|}|S)zu Load the indicated attribute value, called, as a as if it were specified as an entry point. Nzx=)r parseresolve)valparsedrrrr~sztest._resolve_as_epN)r!r)r*__doc__ description user_optionsr7r;r+r>r=rF contextlibcontextmanagerrD staticmethodrUrnrzrxpropertyrsr~rrrrr/Ks&   r/)r[rvrArrlr|distutils.errorsrr distutilsrr pkg_resourcesrrrr r r r r setuptoolsrZ setuptools.extern.more_itertoolsrrr+r/rrrrs  (  (