Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/pbr/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/pbr/__pycache__/testr_command.cpython-37.opt-1.pyc

B

�VF�@s�dZddlmZddlZddlZddlZddlZe�e�Z	Gdd�dej
�ZGdd�dej
�Zyddl
mZd	ZeZWnek
r�d
ZeZYnXdS)a�setuptools/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@s\eZdZdZdddddddgZd	d
dgZdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�ZdS)�	TestrRealzRun unit tests using testr)�coverageNzGReplace PYTHON with coverage and merge coverage from each testr worker.)ztestr-args=�tzRun 'testr' with these args)zomit=�oz(Files to omit from coverage calculations)zcoverage-package-name=Nz"Use this name for coverage package)�slowestNz-Show slowest test times after tests complete.)zno-parallelNzRun testr serially)z
log-level=�lzLog level (default: info)rr�no_parallelcGs2t�d|�t�tjdgt|�tjtjtj	�S)Nz _run_testr called with args = %rr)
�logger�debug�commandsZrun_argv�sys�argv�list�stdin�stdout�stderr)�self�args�r�B/opt/alt/python37/lib/python3.7/site-packages/pbr/testr_command.py�
_run_testrCszTestrReal._run_testrcCs.d|_d|_d|_d|_d|_d|_d|_dS)N��info)�
testr_argsr�omitr�coverage_package_namer	�	log_level)rrrr�initialize_optionsHszTestrReal.initialize_optionscCsptt|j��tj�|_tj|jd�t�d�|jdkr@g|_n|j�	�|_|j
r^d|j
|_
t�d|j�dS)N)�levelzfinalize_options calledz	--omit=%sz$finalize_options: self.__dict__ = %r)�getattr�loggingr�upper�INFOZbasicConfigr
rr�splitr�__dict__)rrrr�finalize_optionsQs


zTestrReal.finalize_optionscCs�t�d�tj�d�s |�d�|jr.|��|jsF|jd
|j	��}n|jd|j	��}|rjt
j�d|��|j
r�td�|�d�|jr�|��d	S)z"Set up testr repo, then run testr.z
run calledz.testrepositoryZinit�run�
--parallelztestr failed (%d)z
Slowest TestsrN)r'r()r')r
r�os�path�isdirrr�_coverage_beforer	r�	distutils�errors�DistutilsErrorr�print�_coverage_after)rZ	testr_retrrrr'`s 



z
TestrReal.runcCsbt�d�|j��}|�d�r*|dd�}|jr6|j}d|}d|tjd<t�dtjd�dS)Nz_coverage_before calledzpython-�z--source %s --parallel-modezcoverage run %sZPYTHONzos.environ['PYTHON'] = %r)r
rZdistributionZget_name�
startswithrr)�environ)r�package�optionsrrrr,us


zTestrReal._coverage_beforecCs(t�d�t�d�t�d|j�dS)Nz_coverage_after calledzcoverage combinezcoverage html -d ./cover %s)r
rr)�systemr)rrrrr1�s

zTestrReal._coverage_afterN)�__name__�
__module__�__qualname__�description�user_optionsZboolean_optionsrrr&r'r,r1rrrrr2s
	
rc@s,eZdZdZgZdd�Zdd�Zdd�ZdS)	�	TestrFakezRun unit tests using testrcCsdS)Nr)rrrrr�szTestrFake.initialize_optionscCsdS)Nr)rrrrr&�szTestrFake.finalize_optionscCstd�dS)Nz7Install testrepository to run 'testr' command properly.)r0)rrrrr'�sz
TestrFake.runN)r8r9r:r;r<rr&r'rrrrr=�s
r=)rTF)�__doc__r-r�distutils.errorsr!r)r
Z	getLoggerr8r
ZCommandrr=ZtestrepositoryrZ
have_testrZTestr�ImportErrorrrrr�<module>'s
V