ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/lib64/python3.6/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/proc/self/root/lib64/python3.6/unittest/__pycache__/main.cpython-36.pyc

3


 \8)�@sldZddlZddlZddlZddlmZmZddlmZdZ	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
cCsxtjj|�rt|j�jd�rttjj|�rXtjj|tj��}tjj|�sP|jtj	�rT|S|}|dd�j
dd�j
dd�S|S)Nz.py��\�.�/���)�os�path�isfile�lower�endswith�isabs�relpath�getcwd�
startswith�pardir�replace)�nameZrel_path�r�/usr/lib64/python3.6/main.py�
_convert_namesrcCsdd�|D�S)NcSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>.sz"_convert_names.<locals>.<listcomp>r)�namesrrr�_convert_names-src@s�eZdZdZdZdZdZZZZ	Z
dZddddej
ddddddfdd�dd	�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__TF)�	tb_localscCs�t|t�r@t|�|_x0|jd�dd�D]}
t|j|
�|_q(Wn||_|dkrTtj}||_||_	|	|_
||_|
|_||_
|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__cCs4|rt|�|jdkr|j�|j�tjd�dS)N�)�print�_discovery_parser�_initArgParsers�_print_helpr(r*)r8�msgrrr�	usageExitas
zTestProgram.usageExitcOsZ|jdkr6t|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_helpcCs�|j�|jdkrpt|�dkrD|dj�dkrD|j|dd��dS|jj|dd�|�|js�|jg�dSn|jj|dd�|�|jr�t|j�|_	t
dkr�d|_n6|jdkr�d|_	n$t|jt
�r�|jf|_	nt|j�|_	|j�dS)Nr�discoverr;r)r>r%�lenr�
_do_discoveryrC�
parse_args�testsr�	testNames�__name__r1r"r#�list�createTests)r8r)rrrr6rs(


zTestProgram.parseArgscCs4|jdkr|jj|j�|_n|jj|j|j�|_dS)N)rNr3ZloadTestsFromModuler%�testZloadTestsFromNames)r8rrrrQ�s

zTestProgram.createTestscCs$|j�}|j|�|_|j|�|_dS)N)�_getParentArgParser�_getMainArgParserrC�_getDiscoveryArgParserr=)r8Z
parent_parserrrrr>�szTestProgram._initArgParserscCs�tjdd�}|jddddddd	�|jd
ddddd
d	�|jddddd�|jdkrn|jdddddd�d|_|jdkr�|jdddddd�d|_|jdkr�|jdddddd�d|_|S)NF)Zadd_helpz-vz	--verboser-�store_constr;zVerbose output)�dest�action�const�helpz-qz--quietrzQuiet outputz--localsr �
store_truez"Show local variables in tracebacks)rWrXrZz-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._getParentArgParsercCs2tj|gd�}|j|_|j|_|jdddd�|S)N)�parentsrM�*z?a list of any number of test modules, classes and test methods.)�nargsrZ)r\r]r5rBr?rEr^)r8�parentr_rrrrT�szTestProgram._getMainArgParsercCs~tj|gd�}d|j|_d|_|jddddd�|jd	d
ddd�|jd
dddd�x"dD]}|j|dtjtjd�q\W|S)N)r`z%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directory�startz*Directory to start discovery ('.' default))rWrZz-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)�?)rbr!rZ)rdrerf)r\r]r5rBZepilogr^ZSUPPRESS)r8rcr_�argrrrrU�s



z"TestProgram._getDiscoveryArgParsercCshd|_d|_d|_|dk	r:|jdkr,|j�|jj||�|dkrH|jn|�}|j|j|j|j�|_dS)Nrztest*.py)	rdrerfr=r>rLr3rIrR)r8r)�LoaderrrrrrK�s
zTestProgram._do_discoverycCs�|jrt�|jdkrtj|_t|jt�r�yVy"|j|j|j|j	|j
|jd�}Wn.tk
r||j|j|j|j	|j
d�}YnXWq�tk
r�|j�}Yq�Xn|j}|j
|j�|_|jr�tj|jj��dS)N)r-r+r.r0r )r-r+r.r0)r,rr2rZTextTestRunnerr"�typer-r+r.r0r �	TypeErrorZrunrR�resultr*r(Z
wasSuccessful)r8r2rrrr7�s.
zTestProgram.runTests)N)N)rO�
__module__�__qualname__�__doc__r%r-r+r,r.r5r0r=rZdefaultTestLoaderr:rAr?r6rQr>rSrTrUrKr7rrrrr1s&#
	
r)ror(r\r�rrZsignalsrZ
__unittestrDrFrr�objectr�mainrrrr�<module>s	T

Zerion Mini Shell 1.0