Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/unittest/__pycache__/main.cpython-37.opt-1.pyc

B

� f�+�@stdZddlZddlZddlZddlmZmZddlmZdZ	dZ
dZd	d
�Zdd�Z
d
d�ZGdd�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
cCsxtj�|�rt|���d�rttj�|�rXtj�|t���}tj�|�sP|�tj	�rT|S|}|dd��
dd��
dd�S|S)Nz.py����\�.�/)�os�path�isfile�lower�endswith�isabs�relpath�getcwd�
startswith�pardir�replace)�nameZrel_path�r�2/opt/alt/python37/lib64/python3.7/unittest/main.py�
_convert_namesrcCsdd�|D�S)NcSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>.sz"_convert_names.<locals>.<listcomp>r)�namesrrr�_convert_names-srcCsd|krd|}|S)N�*z*%s*r)�patternrrr�_convert_select_pattern1src@s�eZdZdZdZdZdZZZZ	Z
ZdZdddde
jddddddfdd�dd	�Zdd
d�Zdd
�Zdd�Zddd�Zdd�Zdd�Zdd�Zdd�Zd dd�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|�d�dd�D]}
t|j|
�|_q(Wn||_|dkrTtj}||_||_	|	|_
||_|
|_||_
|dkr�tjs�d|_n||_||_||_||_tj�|d�|_|�|�|��dS)Nrr�defaultr)�
isinstance�str�
__import__�module�split�getattr�sys�argv�exit�failfast�
catchbreak�	verbosity�bufferr"�warnoptions�warnings�defaultTest�
testRunner�
testLoaderr
r�basename�progName�	parseArgs�runTests)�selfr'r3r+r4r5r,r/r-r.r0r2r"�partrrr�__init__As,


zTestProgram.__init__cCs4|rt|�|jdkr|��|��t�d�dS)N�)�print�_discovery_parser�_initArgParsers�_print_helpr*r,)r:�msgrrr�	usageExitgs
zTestProgram.usageExitcOsZ|jdkr6t|j���ttd|ji�|j��n t|j���ttd|ji�dS)N�prog)	r'r>�_main_parserZformat_help�
MAIN_EXAMPLESr7r?�
print_help�MODULE_EXAMPLES)r:�args�kwargsrrrrAos
zTestProgram._print_helpcCs�|��|jdkrpt|�dkrD|d��dkrD|�|dd��dS|j�|dd�|�|js�|�g�dSn|j�|dd�|�|jr�t|j�|_	t
dkr�d|_n6|jdkr�d|_	n$t|jt
�r�|jf|_	nt|j�|_	|��dS)Nr�discoverr=r!)r@r'�lenr
�
_do_discoveryrE�
parse_args�testsr�	testNames�__name__r3r$r%�list�createTests)r:r+rrrr8xs(


zTestProgram.parseArgscCst|jr|j|j_|r@|dkr"|jn|�}|�|j|j|j�|_n0|jdkr\|j�|j	�|_n|j�
|j|j	�|_dS)N)�testNamePatternsr5rK�startr�top�testrPZloadTestsFromModuler'ZloadTestsFromNames)r:�from_discovery�LoaderrrrrrS�s


zTestProgram.createTestscCs$|��}|�|�|_|�|�|_dS)N)�_getParentArgParser�_getMainArgParserrE�_getDiscoveryArgParserr?)r:Z
parent_parserrrrr@�szTestProgram._initArgParserscCs�tjdd�}|jddddddd	�|jd
ddddd
d	�|jddddd�|jdkrn|jdddddd�d|_|jdkr�|jdddddd�d|_|jdkr�|jdddddd�d|_|jdkr�|jdd d!td"d#�g|_|S)$NF)Zadd_helpz-vz	--verboser/Zstore_constr=zVerbose output)�dest�actionZconst�helpz-qz--quietrzQuiet outputz--localsr"�
store_truez"Show local variables in tracebacks)r]r^r_z-fz
--failfastr-zStop on first fail or errorz-cz--catchr.z'Catch Ctrl-C and display results so farz-bz--bufferr0z%Buffer stdout and stderr during testsz-krT�appendz.Only run tests which match the given substring)r]r^�typer_)�argparse�ArgumentParser�add_argumentr-r.r0rTr)r:�parserrrrrZ�s>








zTestProgram._getParentArgParsercCs2tj|gd�}|j|_|j|_|jdddd�|S)N)�parentsrOrz?a list of any number of test modules, classes and test methods.)�nargsr_)rcrdr7rDrArGre)r:�parentrfrrrr[�szTestProgram._getMainArgParsercCs~tj|gd�}d|j|_d|_|jddddd�|jd	d
ddd�|jd
dddd�x"dD]}|j|dtjtjd�q\W|S)N)rgz%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrUz*Directory to start discovery ('.' default))r]r_z-pz	--patternrz+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrVz<Top level directory of project (defaults to start directory))rUrrV�?)rhr#r_)rcrdr7rDZepilogreZSUPPRESS)r:rirf�argrrrr\�s



z"TestProgram._getDiscoveryArgParsercCsLd|_d|_d|_|dk	r:|jdkr,|��|j�||�|jd|d�dS)Nrztest*.pyT)rXrY)rUrrVr?r@rNrS)r:r+rYrrrrM�s
zTestProgram._do_discoveryc	Cs�|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�|��}Yq�Xn|j}|�
|j�|_|jr�t�|j���dS)N)r/r-r0r2r")r/r-r0r2)r.rr4rZTextTestRunnerr$rbr/r-r0r2r"�	TypeError�runrW�resultr,r*Z
wasSuccessful)r:r4rrrr9�s.
zTestProgram.runTests)N)FN)N)rQ�
__module__�__qualname__�__doc__r'r/r-r.r0r7r2rTr?rZdefaultTestLoaderr<rCrAr8rSr@rZr[r\rMr9rrrrr 7s&#
	
#

r )rqr*rcr
�rrZsignalsrZ
__unittestrFrHrrr�objectr �mainrrrr�<module>s	]

Hacked By AnonymousFox1.0, Coded By AnonymousFox