Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pbr/__pycache__/testr_command.cpython-35.opt-1.pyc



VF@sdZddlmZddlZddlZddlZddlZejeZ	Gdddej
ZGdddej
Zy ddl
mZd	ZeZWnek
rd
ZeZYnXdS)asetuptools/distutils commands to run testr via setup.py

Currently provides 'testr' which runs tests using testr. You can pass
--coverage which will also export PYTHON='coverage run --source <your package>'
and automatically combine the coverage from each testr backend test runner
after the run completes.

To use, just use setuptools/distribute and depend on testr, and it should be
picked up automatically (as the commands are exported in the testrepository
package metadata.
)cmdNc	@seZdZdZd!d"d#d$d%d&d'gZdd
dgZddZddZddZddZ	ddZ
dd ZdS)(	TestrRealzRun unit tests using testrcoverageNGReplace PYTHON with coverage and merge coverage from each testr worker.testr-args=tRun 'testr' with these argsomit=o(Files to omit from coverage calculationscoverage-package-name="Use this name for coverage packageslowest-Show slowest test times after tests complete.no-parallelRun testr serially
log-level=lLog level (default: info)no_parallelcGsCtjd|tjtjdgt|tjtjtj	S)Nz _run_testr called with args = %rr)
loggerdebugcommandsZrun_argvsysargvliststdinstdoutstderr)selfargsr!/testr_command.py
_run_testrCszTestrReal._run_testrcCsCd|_d|_d|_d|_d|_d|_d|_dS)Ninfo)
testr_argsromitrcoverage_package_namer	log_level)rr!r!r"initialize_optionsHs						zTestrReal.initialize_optionscCstt|jjtj|_tjd|jtjd|jdkr\g|_n|jj	|_|j
rd|j
|_
tjd|jdS)Nlevelzfinalize_options calledz	--omit=%sz$finalize_options: self.__dict__ = %r)getattrloggingr)upperINFObasicConfigrrr&splitr'__dict__)rr!r!r"finalize_optionsQs
	zTestrReal.finalize_optionscCstjdtjjds,|jd|jr?|j|jsc|jdd|j	}n|jd|j	}|rt
jjd||j
rtd|jd|jr|jd	S)
z"Set up testr repo, then run testr.z
run calledz.testrepositoryZinitrunz
--parallelztestr failed (%d)z
Slowest TestsrN)rrospathisdirr#r_coverage_beforerr&	distutilserrorsZDistutilsErrorrprint_coverage_after)rZ	testr_retr!r!r"r4`s 

	
		
	

	z
TestrReal.runcCstjd|jj}|jdr;|dd}|jrM|j}d|}d|tjd<tjdtjddS)Nz_coverage_before calledzpython-z--source %s --parallel-modezcoverage run %sPYTHONzos.environ['PYTHON'] = %r)rrZdistributionget_name
startswithr(r5environ)rpackageZoptionsr!r!r"r8us
		
zTestrReal._coverage_beforecCs2tjdtjdtjd|jdS)Nz_coverage_after calledzcoverage combinezcoverage html -d ./cover %s)rrr5systemr')rr!r!r"r<s

zTestrReal._coverage_after)zcoverageNr)rrr)r	r
r)rNr
)zslowestNr)rNr)rrr)__name__
__module____qualname__descriptionuser_optionsZboolean_optionsr#r*r3r4r8r<r!r!r!r"r2s		
rc@s@eZdZdZgZddZddZddZdS)		TestrFakezRun unit tests using testrcCsdS)Nr!)rr!r!r"r*szTestrFake.initialize_optionscCsdS)Nr!)rr!r!r"r3szTestrFake.finalize_optionscCstddS)Nz7Install testrepository to run 'testr' command properly.)r;)rr!r!r"r4sz
TestrFake.runN)rDrErFrGrHr*r3r4r!r!r!r"rIs
rI)rTF)__doc__r9rZdistutils.errorsr-r5r	getLoggerrDrZCommandrrIZtestrepositoryrZ
have_testrZTestrImportErrorr!r!r!r"<module>'sV


Back to Directory File Manager