ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/unittest/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/unittest/__pycache__/main.cpython-34.pyo

�
j f&�@s�dZddlZddlZddlZddlmZmZddlmZdZ	dZ
dZd	d
�Zdd�Z
Gd
d�de�ZeZdS)zUnittest main program�N�)�loader�runner)�installHandlerTz�Examples:
  %(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
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|}n|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/python34/lib64/python3.4/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
dddddddd�Zddd	�Zd
d�Zdd
�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__Tc
Cs"t|t�rZt|�|_xB|jd�dd�D]}t|j|�|_q8Wn	||_|dkr{tj}n||_||_	|	|_
||_|
|_|dkr�tj
r�d|_n	||_||_||_||_tjj|d�|_|j|�|j�dS)Nrr�defaultr)�
isinstance�str�
__import__�module�split�getattr�sys�argv�exit�failfast�
catchbreak�	verbosity�buffer�warnoptions�warnings�defaultTest�
testRunner�
testLoaderrr�basename�progName�	parseArgs�runTests)
�selfr$r0r(r1r2r)r,r*r+r-r/�partrrr�__init__:s* 										
zTestProgram.__init__cCsJ|rt|�n|jdkr/|j�n|j�tjd�dS)N�)�print�_discovery_parser�_initArgParsers�_print_helpr'r))r7�msgrrr�	usageExit_s


zTestProgram.usageExitcOsy|jdkrJt|jj��tti|jd6�|jj�n+t|jj��tti|jd6�dS)N�prog)	r$r;�_main_parserZformat_help�
MAIN_EXAMPLESr4r<�
print_help�MODULE_EXAMPLES)r7�args�kwargsrrrr>gszTestProgram._print_helpcCsH|j�|jdkr�t|�dkr\|dj�dkr\|j|dd��dS|jj|dd�|�|js�|jg�dSn|jj|dd�|�|jr�t|j�|_	t
dkr:d|_q:nQ|jdkrd|_	n6t|jt
�r(|jf|_	nt|j�|_	|j�dS)Nr�discoverr:r)r=r$�lenr�
_do_discoveryrB�
parse_args�testsr�	testNames�__name__r0r!r"�list�createTests)r7r(rrrr5ps(
(	
	zTestProgram.parseArgscCsL|jdkr*|jj|j�|_n|jj|j|j�|_dS)N)rMr2ZloadTestsFromModuler$�testZloadTestsFromNames)r7rrrrP�szTestProgram.createTestscCs4|j�}|j|�|_|j|�|_dS)N)�_getParentArgParser�_getMainArgParserrB�_getDiscoveryArgParserr<)r7Z
parent_parserrrrr=�szTestProgram._initArgParserscCstjdd�}|jddddddd	d
dd�|jd
dddddd	ddd�|jdkr�|jdddddddd�d|_n|jdkr�|jdddddddd�d|_n|jdkr|jdddddddd�d|_n|S)NZadd_helpFz-vz	--verbose�destr,�actionZstore_constZconstr:�helpzVerbose outputz-qz--quietrzQuiet outputz-fz
--failfastr*�
store_truezStop 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-)r7�parserrrrrR�s.zTestProgram._getParentArgParsercCsJtjd|g�}|j|_|j|_|jddddd�|S)N�parentsrL�nargs�*rWz?a list of any number of test modules, classes and test methods.)rYrZr4rAr>rDr[)r7�parentr\rrrrS�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-directoryrU�startrWz*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 )zstartzpatternztop)rYrZr4rAZepilogr[ZSUPPRESS)r7r`r\�argrrrrT�s	
	z"TestProgram._getDiscoveryArgParsercCs�d|_d|_d|_|dk	rY|jdkrC|j�n|jj||�n|dkrn|jn|�}|j|j|j|j�|_dS)Nrztest*.py)	rarbrcr<r=rKr2rHrQ)r7r(ZLoaderrrrrrJ�s			
zTestProgram._do_discoverycCs�|jrt�n|jdkr1tj|_nt|jt�r�y4|jd|jd|jd|j	d|j
�}Wq�tk
r�|j�}Yq�Xn	|j}|j|j
�|_|jr�tj|jj��ndS)Nr,r*r-r/)r+rr1rZTextTestRunnerr!�typer,r*r-r/�	TypeErrorZrunrQ�resultr)r'Z
wasSuccessful)r7r1rrrr6�s 	
		
		zTestProgram.runTests)rN�
__module__�__qualname__�__doc__r$r,r*r+r-r4r/r<rZdefaultTestLoaderr9r@r>r5rPr=rRrSrTrJr6rrrrr0s&		"	r)rkr'rYr�rrZsignalsrZ
__unittestrCrErr�objectr�mainrrrr�<module>s	�

Zerion Mini Shell 1.0