Your IP : 3.138.134.247


Current Path : /opt/alt/python311/lib64/python3.11/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/unittest/__pycache__/main.cpython-311.pyc

�

c��f�,���dZddlZddlZddlZddlZddlmZmZddlm	Z	dZ
dZdZd	�Z
d
�Zd�ZGd�d
e��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
c�V�tj�|���r|����d��r�tj�|��rstj�|tj����}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)�name�rel_paths  �4/opt/alt/python311/lib64/python3.11/unittest/main.py�
_convert_namers���

�w�~�~�d���P��
�
��� 5� 5�e� <� <�P�
�7�=�=����	��w���t�R�Y�[�[�9�9�H��w�}�}�X�&�&�
�(�*=�*=�b�i�*H�*H�
����D��w����%�%�c�r�c�*�2�2�4��=�=�E�E�c�3�O�O�O��K�c��d�|D��S)Nc�,�g|]}t|����S�)r)�.0rs  r�
<listcomp>z"_convert_names.<locals>.<listcomp>/s ��2�2�2�D�M�$���2�2�2rr)�namess r�_convert_namesr#.s��2�2�E�2�2�2�2rc��d|vrd|z}|S)N�*z*%s*r)�patterns r�_convert_select_patternr'2s���'�>�>��7�"���Nrc��eZdZdZdZdZdxZxZxZxZ	xZ
ZdZdddde
jddddddfdd�d�Zdd	�Zd
�Zd�Zdd�Zd
�Zd�Zd�Zd�Zdd�Zd�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�V�t|t��rOt|��|_|�d��dd�D]}
t|j|
��|_�n||_|�tj}||_||_	|	|_
||_|
|_||_
|�tjsd|_n||_||_||_||_t&j�|d��|_|�|��|���dS)Nr
r�defaultr)�
isinstance�str�
__import__�module�split�getattr�sys�argv�exit�failfast�
catchbreak�	verbosity�bufferr+�warnoptions�warnings�defaultTest�
testRunner�
testLoaderrr
�basename�progName�	parseArgs�runTests)�selfr1r=r5r>r?r6r9r7r8r:r<r+�parts              r�__init__zTestProgram.__init__Bs���f�c�"�"�	!�$�V�,�,�D�K����S�)�)�!�"�"�-�
9�
9��%�d�k�4�8�8����
9�!�D�K��<��8�D���	� ��
�$���"������"�����C�O��&�D�M�M�%�D�M�&���$���$�����(�(��a��1�1��
����t�����
�
�����rc���tjdt��|rt|��|j�|���|���tjd��dS)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13�)	r<�warn�DeprecationWarning�print�_discovery_parser�_initArgParsers�_print_helpr4r6)rD�msgs  r�	usageExitzTestProgram.usageExithsr���
�0�1C�	E�	E�	E��	��#�J�J�J��!�)�� � �"�"�"��������������rc�Z�|j�_t|j�����ttd|jiz��|j���dSt|j�����ttd|jiz��dS)N�prog)	r1rK�_main_parser�format_help�
MAIN_EXAMPLESrArL�
print_help�MODULE_EXAMPLES)rD�args�kwargss   rrNzTestProgram._print_helprs����;���$�#�/�/�1�1�2�2�2��-�6�4�=�"9�9�:�:�:��"�-�-�/�/�/�/�/��$�#�/�/�1�1�2�2�2��/�V�T�]�$;�;�<�<�<�<�<rc���|���|j��t|��dkr=|d���dkr|�|dd���dS|j�|dd�|��|js|�g��dSn#|j�|dd�|��|jr,t|j��|_	tdkrd|_nP|j�d|_	nAt|jt��r|jf|_	nt|j��|_	|���dS)Nr�discoverrHr*)rMr1�lenr�
_do_discoveryrS�
parse_args�testsr#�	testNames�__name__r=r.r/�list�createTests)rDr5s  rrBzTestProgram.parseArgs{s^���������;���4�y�y�1�}�}��a������J�!>�!>��"�"�4����8�,�,�,�����(�(��a�b�b��4�8�8�8��:�
��"�"�2�&�&�&���	
�
��(�(��a�b�b��4�8�8�8��:�	4�+�D�J�7�7�D�N��:�%�%�"����
�
�
%�!�D�N�N�
��(�#�
.�
.�	4�"�.�0�D�N�N�!�$�"2�3�3�D�N��������rc�^�|jr|j|j_|r;|�|jn	|��}|j|j|j|j��|_dS|j�&|j�|j	��|_dS|j�
|j|j	��|_dS�N)�testNamePatternsr?r[�startr&�top�testr`�loadTestsFromModuler1�loadTestsFromNames)rD�from_discovery�Loaderrs    rrczTestProgram.createTests�s���� �	E�/3�/D�D�O�,��	H�(.��T�_�_�F�F�H�H�F�'����
�D�L�$�(�K�K�D�I�I�I�
�^�
#���;�;�D�K�H�H�D�I�I�I���:�:�4�>�;?�;�H�H�D�I�I�Irc��|���}|�|��|_|�|��|_dSre)�_getParentArgParser�_getMainArgParserrS�_getDiscoveryArgParserrL)rD�
parent_parsers  rrMzTestProgram._initArgParsers�sE���0�0�2�2�
� �2�2�=�A�A���!%�!<�!<�]�!K�!K����rc��tjd���}|�dddddd�	��|�d
ddddd
�	��|�dddd���|j�!|�ddddd���d|_|j�!|�ddddd���d|_|j�!|�ddddd���d|_|j�&|�dd d!td"�#��g|_|S)$NF)�add_helpz-vz	--verboser9�store_constrHzVerbose output)�dest�action�const�helpz-qz--quietrzQuiet outputz--localsr+�
store_truez"Show local variables in tracebacks)rvrwryz-fz
--failfastr7zStop on first fail or errorz-cz--catchr8z'Catch Ctrl-C and display results so farz-bz--bufferr:z%Buffer stdout and stderr during testsz-krf�appendz.Only run tests which match the given substring)rvrw�typery)�argparse�ArgumentParser�add_argumentr7r8r:rfr')rD�parsers  rrozTestProgram._getParentArgParser�s����(�%�8�8�8�����D�+�K�#0��!1�	�	3�	3�	3�	���D�)�+�#0��!/�	�	1�	1�	1�	���J�[�#/�!E�	�	G�	G�	G��=� �����l��'3�%B�
 �
D�
D�
D�"�D�M��?�"�����i�l�'3�%N�
 �
P�
P�
P�$�D�O��;������j�x�'3�%L�
 �
N�
N�
N� �D�K�� �(�����+=�'/�6M�%U�
 �
W�
W�
W�%'�D�!��
rc��tj|g���}|j|_|j|_|�ddd���|S)N��parentsr_r%z?a list of any number of test modules, classes and test methods.)�nargsry)r}r~rArRrNrVr)rD�parentr�s   rrpzTestProgram._getMainArgParser�sX���(�&��:�:�:���m��� �,������G�3�"8�	�	9�	9�	9��
rc�X�tj|g���}d|jz|_d|_|�dddd���|�d	d
dd���|�d
ddd���dD]/}|�|dtjtj����0|S)Nr�z%s discoverzcFor test discovery all test modules must be importable from the top level directory of the project.z-sz--start-directoryrgz*Directory to start discovery ('.' default))rvryz-pz	--patternr&z+Pattern to match tests ('test*.py' default)z-tz--top-level-directoryrhz<Top level directory of project (defaults to start directory))rgr&rh�?)r�r-ry)r}r~rArR�epilogr�SUPPRESS)rDr�r��args    rrqz"TestProgram._getDiscoveryArgParser�s����(�&��:�:�:��#�d�m�3���$��
�	���D�"5�G�!M�	�	O�	O�	O����D�+�I�!N�	�	P�	P�	P����D�"9��"4�	�	5�	5�	5�/�	8�	8�C�����3�(0�(9�%-�%6�
 �
8�
8�
8�
8��
rc���d|_d|_d|_|�6|j�|���|j�||��|�d|���dS)Nr
ztest*.pyT)rlrm)rgr&rhrLrMr^rc)rDr5rms   rr]zTestProgram._do_discovery�sp����
�!���������%�-��$�$�&�&�&��"�-�-�d�D�9�9�9�����V��<�<�<�<�<rc�z�|jrt��|j�tj|_t|jt��r�		|�|j|j|j	|j
|j���}n=#t$r0|�|j|j|j	|j
���}YnwxYwn+#t$r|���}YnwxYw|j}|�
|j��|_|jr.t#j|j�����dSdS)N)r9r7r:r<r+)r9r7r:r<)r8rr>r�TextTestRunnerr.r|r9r7r:r<r+�	TypeError�runri�resultr6r4�
wasSuccessful)rDr>s  rrCzTestProgram.runTests�sY���?�	������?�"�$�3�D�O��d�o�t�,�,�	)�
/�I�!%���4�>�:>�-�8<��:>�-�;?�>�	"1�"K�"K�J�J��
!�I�I�I�!%���4�>�:>�-�8<��:>�-�"1�"I�"I�J�J�J�I�������
/�
/�
/�!�_�_�.�.�
�
�
�
/����
��J� �n�n�T�Y�/�/����9�	6��H���2�2�4�4�4�5�5�5�5�5�	6�	6s0�
3A>�=B<�>7B8�5B<�7B8�8B<�<C�Cre)FN)ra�
__module__�__qualname__�__doc__r1r9r7r8r:rAr<rfrLr�defaultTestLoaderrFrPrNrBrcrMrorprqr]rCrrrr)r)8s>���������F��I�NR�R�H�R�z�R�F�R�X�R��;K���(�d��#��0H���T�d��$�$�>C�$�$�$�$�$�L����=�=�=����:
H�
H�
H�
H�L�L�L�
!�!�!�F	�	�	����*=�=�=�=�6�6�6�6�6rr))r�r4r}rr<�rr�signalsr�
__unittestrUrWrr#r'�objectr)�mainrrr�<module>r�s�����
�
�
�
�����	�	�	�	�������������#�#�#�#�#�#�
�
��
������ 3�3�3����\6�\6�\6�\6�\6�&�\6�\6�\6�|���r

?>