AlkantarClanX12

Your IP : 3.145.75.238


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



��Yf8)�@s�dZddlZddlZddlZddlmZmZddlmZdZ	dZ
dZd	d
�Zdd�Z
Gd
d�de�ZeZdS)zUnittest main program�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�2/opt/alt/python35/lib64/python3.5/unittest/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�eZdZdZdZdZdZZZZ	Z
dZddddej
dddddddddd	�Zdd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zddd�Zdd�ZdS)�TestProgramzA command-line program that runs a set of tests; this is primarily
       for making test modules conveniently executable.
    Nr�__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_parserZformat_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)rNr3ZloadTestsFromModuler%�testZloadTestsFromNames)r8rrrrQ�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)!NZadd_helpFz-vz	--verbose�destr-�actionZstore_constZconstr;�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�parserrrrrS�s4			zTestProgram._getParentArgParsercCsJtjd|g�}|j|_|j|_|jddddd�|S)N�parentsrM�nargs�*rXz?a list of any number of test modules, classes and test methods.)rZr[r5rBr?rEr\)r8�parentr]rrrrT�szTestProgram._getMainArgParserc	Cs�tjd|g�}d|j|_d|_|jdddddd	�|jd
ddddd
�|jdddddd�x3dD]+}|j|dddtjdtj�q�W|S)Nr^z%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrV�startrXz*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)r_�?r!)rbrcrd)rZr[r5rBZepilogr\ZSUPPRESS)r8rar]�argrrrrU�s	
	z"TestProgram._getDiscoveryArgParsercCs�d|_d|_d|_|dk	rS|jdkr@|j�|jj||�|dkrh|jn|�}|j|j|j|j�|_dS)Nrztest*.py)	rbrcrdr=r>rLr3rIrR)r8r)�LoaderrrrrrK�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 �	TypeErrorZrunrR�resultr*r(Z
wasSuccessful)r8r2rrrr7�s.				
		
		zTestProgram.runTests)rO�
__module__�__qualname__�__doc__r%r-r+r,r.r5r0r=rZdefaultTestLoaderr:rAr?r6rQr>rSrTrUrKr7rrrrr1s&		#	r)rmr(rZr�rrZsignalsrZ
__unittestrDrFrr�objectr�mainrrrr�<module>s	�