HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/unittest/__pycache__/main.cpython-310.pyc
o

�i�+�@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
cCs�tj�|�r>|���d�r>tj�|�r,tj�|t���}tj�|�s(|�tj	�r*|S|}tj�
|�dd��dd��dd�S|S)Nz.py����\�.�/)�os�path�isfile�lower�endswith�isabs�relpath�getcwd�
startswith�pardir�normpath�replace)�nameZrel_path�r�*/usr/local/lib/python3.10/unittest/main.py�
_convert_names$rcCsdd�|D�S)NcSsg|]}t|��qSr)r)�.0rrrr�
<listcomp>.sz"_convert_names.<locals>.<listcomp>r)�namesrrr�_convert_names-srcCsd|vrd|}|S)N�*z*%s*r)�patternrrr�_convert_select_pattern1sr c@s�eZdZdZdZdZdZZZZ	Z
ZdZdddde
jddddddfdd�dd	�Zdd
d�Zdd
�Zdd�Zddd�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�rt|�|_|�d�dd�D]	}
t|j|
�|_qn||_|dur(tj}||_||_	|	|_
||_|
|_||_
|durEtjsEd|_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(r4r,r5r6r-r0r.r/r1r3r#�partrrr�__init__As.

�
zTestProgram.__init__cCs4|rt|�|jdur|��|��t�d�dS)N�)�print�_discovery_parser�_initArgParsers�_print_helpr+r-)r;�msgrrr�	usageExitgs
zTestProgram.usageExitcOs\|jdurt|j���ttd|ji�|j��dSt|j���ttd|ji�dS)N�prog)	r(r?�_main_parser�format_help�
MAIN_EXAMPLESr8r@�
print_help�MODULE_EXAMPLES)r;�args�kwargsrrrrBos
zTestProgram._print_helpcCs�|��|jdur8t|�dkr"|d��dkr"|�|dd��dS|j�|dd�|�|js7|�g�dSn|j�|dd�|�|jrTt|j�|_	t
dkrSd|_n|jdur]d|_	nt|jt
�ri|jf|_	nt|j�|_	|��dS)Nr�discoverr>r")rAr(�lenr
�
_do_discoveryrF�
parse_args�testsr�	testNames�__name__r4r%r&�list�createTests)r;r,rrrr9xs,

��
zTestProgram.parseArgscCsx|jr|j|j_|r!|dur|jn|�}|�|j|j|j�|_dS|jdur0|j�|j	�|_dS|j�
|j|j	�|_dS�N)�testNamePatternsr6rM�startr�top�testrRZloadTestsFromModuler(ZloadTestsFromNames)r;�from_discovery�LoaderrrrrrU�s



�zTestProgram.createTestscCs$|��}|�|�|_|�|�|_dSrV)�_getParentArgParser�_getMainArgParserrF�_getDiscoveryArgParserr@)r;Z
parent_parserrrrrA�szTestProgram._initArgParserscCs�tjdd�}|jddddddd	�|jd
ddddd
d	�|jddddd�|jdur7|jdddddd�d|_|jdurI|jdddddd�d|_|jdur[|jdddddd�d|_|jdurm|jdd d!td"d#�g|_|S)$NF)�add_helpz-vz	--verboser0�store_constr>zVerbose output)�dest�action�const�helpz-qz--quietrzQuiet outputz--localsr#�
store_truez"Show local variables in tracebacks)rbrcrez-fz
--failfastr.zStop on first fail or errorz-cz--catchr/z'Catch Ctrl-C and display results so farz-bz--bufferr1z%Buffer stdout and stderr during testsz-krW�appendz.Only run tests which match the given substring)rbrc�typere)�argparse�ArgumentParser�add_argumentr.r/r1rWr )r;�parserrrrr]�sL
�
��

�

�

�
�zTestProgram._getParentArgParsercCs2tj|gd�}|j|_|j|_|jdddd�|S)N��parentsrQrz?a list of any number of test modules, classes and test methods.)�nargsre)rirjr8rErBrIrk)r;�parentrlrrrr^�s�zTestProgram._getMainArgParsercCsztj|gd�}d|j|_d|_|jddddd�|jd	d
ddd�|jd
dddd�dD]
}|j|dtjtjd�q-|S)Nrmz%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrXz*Directory to start discovery ('.' default))rbrez-pz	--patternrz+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrYz<Top level directory of project (defaults to start directory))rXrrY�?)ror$re)rirjr8rE�epilogrk�SUPPRESS)r;rprl�argrrrr_�s$
�
�
��z"TestProgram._getDiscoveryArgParsercCsLd|_d|_d|_|dur|jdur|��|j�||�|jd|d�dS)Nrztest*.pyT)r[r\)rXrrYr@rArPrU)r;r,r\rrrrO�s
zTestProgram._do_discoveryc	Cs�|jrt�|jdurtj|_t|jt�rMz*z|j|j|j|j	|j
|jd�}Wnty=|j|j|j|j	|j
d�}YnwWntyL|��}Ynw|j}|�
|j�|_|jret�|j���dSdS)N)r0r.r1r3r#)r0r.r1r3)r/rr5rZTextTestRunnerr%rhr0r.r1r3r#�	TypeError�runrZ�resultr-r+Z
wasSuccessful)r;r5rrrr:�s:

�
�����zTestProgram.runTestsrV)FN)rS�
__module__�__qualname__�__doc__r(r0r.r/r1r8r3rWr@rZdefaultTestLoaderr=rDrBr9rUrAr]r^r_rOr:rrrrr!7s.��
&	
#

r!)rzr+rir
�rrZsignalsrZ
__unittestrHrJrrr �objectr!�mainrrrr�<module>s	]