AlkantarClanX12

Your IP : 3.145.58.158


Current Path : /lib64/python3.8/unittest/__pycache__/
Upload File :
Current File : //lib64/python3.8/unittest/__pycache__/main.cpython-38.opt-1.pyc

U

e5d�+�@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�%/usr/lib64/python3.8/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|�|_|�d�dd�D]}
t|j|
�|_q&n||_|dkrPtj}||_||_	|	|_
||_|
|_||_
|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$|��}|�|�|_|�|�|_dSrT)�_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-krU�appendz.Only run tests which match the given substring)r^r_�typer`)�argparse�ArgumentParser�add_argumentr-r.r0rUr)r:�parserrrrr[�sR
�
��

�

�

�
�zTestProgram._getParentArgParsercCs2tj|gd�}|j|_|j|_|jdddd�|S)N��parentsrOrz?a list of any number of test modules, classes and test methods.)�nargsr`)rdrer7rDrArGrf)r:�parentrgrrrr\�s�zTestProgram._getMainArgParsercCsztj|gd�}d|j|_d|_|jddddd�|jd	d
ddd�|jd
dddd�dD]}|j|dtjtjd�qZ|S)Nrhz%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrVz*Directory to start discovery ('.' default))r^r`z-pz	--patternrz+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrWz<Top level directory of project (defaults to start directory))rVrrW�?)rjr#r`)rdrer7rDZepilogrfZSUPPRESS)r:rkrg�argrrrr]�s$
�
�
��z"TestProgram._getDiscoveryArgParsercCsLd|_d|_d|_|dk	r:|jdkr,|��|j�||�|jd|d�dS)Nrztest*.pyT)rYrZ)rVrrWr?r@rNrS)r:r+rZrrrrM�s
zTestProgram._do_discoveryc	Cs�|jrt�|jdkrtj|_t|jt�r�zVz"|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$rcr/r-r0r2r"�	TypeError�runrX�resultr,r*Z
wasSuccessful)r:r4rrrr9�s2
�
�zTestProgram.runTests)N)FN)N)rQ�
__module__�__qualname__�__doc__r'r/r-r.r0r7r2rUr?rZdefaultTestLoaderr<rCrAr8rSr@r[r\r]rMr9rrrrr 7s6��&
	
#

r )rsr*rdr
�rrZsignalsrZ
__unittestrFrHrrr�objectr �mainrrrr�<module>s	]