AlkantarClanX12

Your IP : 3.133.117.113


Current Path : /opt/alt/python35/lib64/python3.5/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/unittest/__pycache__/main.cpython-35.opt-2.pyc



���]8)�@s�ddlZddlZddlZddlmZmZddlmZdZdZ	dZ
dd	�Zd
d�ZGdd
�d
e
�ZeZdS)�N�)�loader�runner)�installHandlerTaExamples:
  %(prog)s test_module               - run tests from test_module
  %(prog)s module.TestClass          - run tests from module.TestClass
  %(prog)s module.Class.test_method  - run specified test method
  %(prog)s path/to/test_file.py      - run tests from test_file.py
aFExamples:
  %(prog)s                           - run default set of tests
  %(prog)s MyTestSuite               - run suite 'MyTestSuite'
  %(prog)s MyTestCase.testSomething  - run MyTestCase.testSomething
  %(prog)s MyTestCase                - run all 'test*' test methods
                                       in MyTestCase
cCs�tjj|�r�|j�jd�r�tjj|�r�tjj|tj��}tjj|�sx|jtj	�r||S|}|dd�j
dd�j
dd�S|S)Nz.py��\�.�/���)�os�path�isfile�lower�endswith�isabs�relpath�getcwd�
startswith�pardir�replace)�nameZrel_path�r�)/opt/alt/python35/lib64/python3.5/main.py�
_convert_names'$&rcCsdd�|D�S)NcSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>.s	z"_convert_names.<locals>.<listcomp>r)�namesrrr�_convert_names-src@s�eZdZdZdZdZZZZZ	dZ
ddddejdddddddddd�Z
dd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zddd�Zdd�ZdS)�TestProgramNr�__main__T�	tb_localsFcCs(t|t�rZt|�|_xB|jd�dd�D]}
t|j|
�|_q8Wn	||_|dkrxtj}||_||_	|	|_
||_|
|_||_
|dkr�tjr�d|_n	||_||_||_||_tjj|d�|_|j|�|j�dS)Nrr�defaultr)�
isinstance�str�
__import__�module�split�getattr�sys�argv�exit�failfast�
catchbreak�	verbosity�bufferr �warnoptions�warnings�defaultTest�
testRunner�
testLoaderrr�basename�progName�	parseArgs�runTests)�selfr%r1r)r2r3r*r-r+r,r.r0r �partrrr�__init__;s, 												
zTestProgram.__init__cCsD|rt|�|jdkr)|j�|j�tjd�dS)N�)�print�_discovery_parser�_initArgParsers�_print_helpr(r*)r8�msgrrr�	usageExitas


zTestProgram.usageExitcOsw|jdkrIt|jj��ttd|ji�|jj�n*t|jj��ttd|ji�dS)N�prog)	r%r<�_main_parser�format_help�
MAIN_EXAMPLESr5r=�
print_help�MODULE_EXAMPLES)r8�args�kwargsrrrr?iszTestProgram._print_helpcCsE|j�|jdkr�t|�dkr\|dj�dkr\|j|dd��dS|jj|dd�|�|js�|jg�dSn|jj|dd�|�|jr�t|j�|_	t
dkr7d|_nQ|jdkrd|_	n6t|jt
�r%|jf|_	nt|j�|_	|j�dS)Nr�discoverr;r)r>r%�lenr�
_do_discoveryrC�
parse_args�testsr�	testNames�__name__r1r"r#�list�createTests)r8r)rrrr6rs(
(	
	zTestProgram.parseArgscCsL|jdkr*|jj|j�|_n|jj|j|j�|_dS)N)rOr3ZloadTestsFromModuler%�testZloadTestsFromNames)r8rrrrR�szTestProgram.createTestscCs4|j�}|j|�|_|j|�|_dS)N)�_getParentArgParser�_getMainArgParserrC�_getDiscoveryArgParserr=)r8Z
parent_parserrrrr>�szTestProgram._initArgParserscCs3tjdd�}|jddddddd	d
dd�|jd
dddddd	ddd�|jddddddd�|jdkr�|jdddddddd�d|_|jdkr�|jdddddddd�d|_|jdkr/|jdddddddd �d|_|S)!N�add_helpFz-vz	--verbose�destr-�action�store_const�constr;�helpzVerbose outputz-qz--quietrzQuiet outputz--localsr �
store_truez"Show local variables in tracebacksz-fz
--failfastr+zStop on first fail or errorz-cz--catchr,z'Catch Ctrl-C and display results so farz-bz--bufferr.z%Buffer stdout and stderr during tests)�argparse�ArgumentParser�add_argumentr+r,r.)r8�parserrrrrT�s4			zTestProgram._getParentArgParsercCsJtjd|g�}|j|_|j|_|jddddd�|S)N�parentsrN�nargs�*r\z?a list of any number of test modules, classes and test methods.)r^r_r5rBr?rFr`)r8�parentrarrrrU�szTestProgram._getMainArgParserc	Cs�tjd|g�}d|j|_d|_|jdddddd	�|jd
ddddd
�|jdddddd�x3dD]+}|j|dddtjdtj�q�W|S)Nrbz%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrX�startr\z*Directory to start discovery ('.' default)z-pz	--pattern�patternz+Pattern to match tests ('test*.py' default)z-tz--top-level-directory�topz<Top level directory of project (defaults to start directory)rc�?r!)rfrgrh)r^r_r5rB�epilogr`�SUPPRESS)r8rera�argrrrrV�s	
	z"TestProgram._getDiscoveryArgParsercCs�d|_d|_d|_|dk	rS|jdkr@|j�|jj||�|dkrh|jn|�}|j|j|j|j�|_dS)Nrztest*.py)	rfrgrhr=r>rMr3rJrS)r8r)�LoaderrrrrrL�s			
zTestProgram._do_discoverycCs)|jrt�|jdkr+tj|_t|jt�r�y�y=|jd|jd|jd|j	d|j
d|j�}WnBtk
r�|jd|jd|jd|j	d|j
�}YnXWq�tk
r�|j�}Yq�Xn	|j}|j
|j�|_|jr%tj|jj��dS)Nr-r+r.r0r )r,rr2rZTextTestRunnerr"�typer-r+r.r0r �	TypeError�runrS�resultr*r(Z
wasSuccessful)r8r2rrrr7�s.				
		
		zTestProgram.runTests)rP�
__module__�__qualname__r%r-r+r,r.r5r0r=rZdefaultTestLoaderr:rAr?r6rRr>rTrUrVrLr7rrrrr1s$		#	r)r(r^r�rrZsignalsrZ
__unittestrErGrr�objectr�mainrrrr�<module>s	�