MRe,@sddlmZddlmZddlZddlTddlmZddlmZm Z GdddeZ Gd d d eZ dS) )Command)DistutilsOptionErrorN)*)_namespace_packages) TestLoadermainc@seZdZddZdS)ScanningLoadercCs,g}|jdkr1|jtj||nt|drV|j|jnt|drxt|jdD]}|jdr|dkr|jd|dd }n-t|j|d rx|jd|}nqx|j|j |qxWnt |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. zsetuptools.tests.doctestadditional_tests__path__z.pyz __init__.py.Nz /__init__.pyr) __name__appendrloadTestsFromModulehasattrr resource_listdirendswithresource_existsZloadTestsFromNamelenZ suiteClass)selfmoduletestsfile submoduler2/tmp/pip-l4uy7dan-build/setuptools/command/test.pyr s" z"ScanningLoader.loadTestsFromModuleN)r __module__ __qualname__rrrrrrs rc@sdeZdZdZdZddgZd d Zd d Zd dZddZ ddZ dS)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=s1Test suite to run (e.g. 'some_module.test_suite')cCsd|_d|_d|_dS)N) test_suite test_module test_loader)rrrrinitialize_options7s  ztest.initialize_optionscCs|jdkrC|jdkr0|jj|_q[|jd|_n|jr[tdn|jg|_|jr|jjddn|jdkrt|jdd|_n|jdkrd|_ndS)Nz .test_suitez1You may specify a module or a suite, but not bothrz --verboser*z&setuptools.command.test:ScanningLoader) r(r) distributionr test_argsverboseinsertr*getattr)rrrrfinalize_options=s   ztest.finalize_optionsc Cstjdkrt|jddr|jddd|jd|jd}t|j}|jdd||jd|jd dd|jd n-|jd|jd dd |jd |jd}tj dd}tj j }z[tj j dt|j tjtd d td |j|jf|Wd|tj ddtsz/test.with_project_on_sys_path..z%s==%s)r )sys version_infor0r,reinitialize_command run_commandget_finalized_commandnormalize_path build_libpathmodulescopyr/r5 working_set__init__add_activation_listenerrequireegg_nameZ egg_versionclearupdate)rfuncZbpy_cmdZ build_pathZei_cmdZold_pathZ old_modulesrrrwith_project_on_sys_pathTs2$       ztest.with_project_on_sys_pathcCs|jjr%|jj|jjn|jjrJ|jj|jjn|jrdj|j}|jr|jd|q|jd||j |j ndS)N z skipping "unittest %s" (dry run)zrunning "unittest %s") r,Zinstall_requiresZfetch_build_eggsZ tests_requirer(joinr-dry_runannouncerL run_tests)rcmdrrrrun~s    ztest.runcCs2ddl}tjd krt|jddr|jd jdd}|tkrg}|tjkr{|j |n|d7}x0tjD]%}|j |r|j |qqWt t tjj |qntjd|j}|jdd}|}|jdd|jg|jd |dS) Nrr r2Frr zx=rGZ testLoader)r )unittestr:r;r0r,r-splitrrBr startswithlistmap __delitem__ EntryPointparser*loadr__file__)rrUrZ del_modulesnameZ loader_ep loader_classZcksrrrrQs$ $   ztest.run_testsN)r"r#r$)r%r&r') rrr __doc__ description user_optionsr+r1rLrSrQrrrrr!+s     * r!) setuptoolsrdistutils.errorsrr: pkg_resourcesrrUrrrr!rrrrs  #