PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/suite.cpython-312.pyc

�

���g�W���dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
ddlZejdk(r:ej ddd	krddlZej$d
�ddlmZnGd�d
e�Zej,e�Ze�Zd�ZGd�de�ZGd�dej:�ZGd�de�ZGd�de�Z Gd�de�Z!Gd�dej:�Z"Gd�d�Z#Gd�d�Z$y)z�
Test Suites
-----------

Provides a LazySuite, which is a suite whose test list is a generator
function, and ContextSuite,which can run fixtures (setup/teardown
functions or methods) for the context that contains its tests.

�N)�Test)�Config)�ResultProxyFactory)�isclass�resolve_name�try_run�cli�)r
��
IronPython)�StringExceptionc��eZdZy)r
N)�__name__�
__module__�__qualname__���9/opt/hc_python/lib/python3.12/site-packages/nose/suite.pyr
r
s��rr
c�8�|j�d|j��S)N�.)rr)�clss r�	_strclassr%s���n�n�c�l�l�3�3rc��eZdZdZy)�MixedContextErrorzQError raised when a context suite sees tests from more than
    one context.
    N)rrr�__doc__rrrrr(s���	rrc�n��eZdZdZd
�fd�	Zd�Zd�Zd�ZeZd�Z	d�Z
d�Zd	�Zd
�Z
eee
dd�Z�xZS)�	LazySuitez:A suite that may use a generator as its list of tests
    c�L��tt|��|j|�y)zFInitialize the suite. tests may be an iterable or a generator
        N)�superr�__init__�
_set_tests)�self�tests�	__class__s  �rr zLazySuite.__init__2s���	�i��'�)�����rc�,�t|j�S�N)�iter�_tests�r"s r�__iter__zLazySuite.__iter__8s���D�K�K� � rc�L�dt|j��dt|��d�S)N�<z tests=generator (z)>)rr$�idr)s r�__repr__zLazySuite.__repr__;s���d�n�n�%�r�$�x�1�	1rc�,�tj|�Sr&��object�__hash__r)s rr2zLazySuite.__hash__?������t�$�$rc�:�|jj|�yr&)�	_precache�append�r"�tests  r�addTestzLazySuite.addTestDs�������d�#rc�V�|jD]}|jr|S||��|Sr&)r(�
shouldStop)r"�resultr8s   r�runz
LazySuite.runHs1���K�K�D�� � ���
�
��L� ��
rc��tjdt|��|jry|j�y	t|j�}|�|jj
|�y	y#t$rYywxYw)Nztests in %s?TF)�log�debugr-r5�test_generator�nextr6�
StopIterationr7s  r�__bool__zLazySuite.__bool__Os~���	�	�.�"�T�(�+��>�>�����&��	���+�+�,�D������%�%�d�+�� �
���	���	�s�2A0�0	A<�;A<c#�K�tjd|j�|jD]}|���|j�y|jD]}|���y�w)Nzprecache is %s)r?r@r5rAr7s  r�
_get_testszLazySuite._get_tests^sP�����	�	�"�D�N�N�3��N�N�D��J�#����&���'�'�D��J�(�s�AAc��g|_t|tj�}t|tj
�r|s
|�|_y|r|j|g�d|_y|j|�d|_yr&)r5�
isinstance�unittest�	TestSuite�collections�CallablerA�addTests)r"r#�is_suites   rr!zLazySuite._set_testsgsf������e�X�%7�%7�8���e�[�1�1�2�8�"'�'�D��
�
�M�M�5�'�"�"&�D���M�M�%� �"&�D�rNzbAccess the tests in this suite. Access is through a generator, so iteration may not be repeatable.)r)rrrrr r*r.r2�__str__r9r=rDrFr!�propertyr(�
__classcell__�r$s@rrr/sU�����!�1�%��G�$��
��'��j�*�d�G�H�Frrc���eZdZdZej
jZdZdZdZ	dZ
dZdZdZ
dZ		d�fd
�	Zd�ZeZd�Zd
�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Ze ee!jDd	d�Z#�xZ$S)�ContextSuitea4A suite with context.

    A ContextSuite executes fixtures (setup and teardown functions or
    methods) for the context containing its tests.

    The context may be explicitly passed. If it is not, a context (or
    nested set of contexts) will be constructed by examining the tests
    in the suite.
    F)�setup_class�	setup_all�
setupClass�setupAll�
setUpClass�setUpAll)�teardown_class�teardown_all�
teardownClass�teardownAll�
tearDownClass�tearDownAll)�setup_module�setupModule�setUpModule�setup�setUp)�teardown_module�teardownModule�tearDownModule�teardown�tearDown)�
setup_package�setupPackage�setUpPackage)�teardown_package�teardownPackage�tearDownPackageNc����tjd||t|��||_||_|�
t�}||_||_d|_||_	d|_
tt|�7|�y)NzContext suite for %s (%s) (%s)F)r?r@r-�context�factoryr�config�resultProxy�has_run�	can_split�
error_contextrrTr )r"r#rrrsrtrurwr$s       �rr zContextSuite.__init__�sh����	�	�2�E�7�B�t�H�M��������>��X�F����&������"���!���
�l�D�*�5�1rc�x�dt|j��dt|jd|j��d�S)Nr,z	 context=r�>)rr$�getattrrrr)s rr.zContextSuite.__repr__�s,���d�n�n�%��D�L�L�*�d�l�l�;�=�	=rc�d�|jrt|��d|j��St|�S)N�:)rx�reprr)s rr-zContextSuite.id�s*�����"�4�j�$�*<�*<�=�=���:�rc�,�tj|�Sr&r0r)s rr2zContextSuite.__hash__�r3rc�&�|j|i|��Sr&�r=�r"�arg�kws   r�__call__zContextSuite.__call__�����t�x�x��#��#�#rc�*�tj�S)z.Hook for replacing error tuple output
        )�sys�exc_infor)s rr�zContextSuite.exc_info�s���|�|�~�rc��|j�}tjdk(r*t|dt�rt|d�|d|df}|S)z:Bottleneck to fix up IronPython string exceptions
        r	r�r
)r�r��platformrHr
�str)r"�es  r�	_exc_infozContextSuite._exc_info�sL��
�M�M�O���<�<�5� ��!�A�$��0���1��Y��!��a��d�+���rc���tjdt|�||j�|jr|j	||�|}}n||}}	|j�	|jD]-}|jrtjd�n
||��/d|_	|j�y#t$r�d|_|j||j��YyxYw#t$r�d|_|j||j��YyxYw#d|_	|j�w#t$r�d|_|j||j��YwxYwxYw)z5Run tests in suite inside of suite fixtures.
        z#suite %s (%s) run called, tests: %srdN�stoppingTri)
r?r@r-r(rure�KeyboardInterruptrx�addErrorr�r;rvrj)r"r<�origr8s    rr=zContextSuite.run�sL��	�	�	�7��D��4����U�����+�+�F�D�9�6�D�F�!�6�D�F�	��J�J�L�	8������$�$��I�I�j�)���T�
�$� �D�L�
8��
�
���%!�	��	�!(�D���O�O�D�$�.�.�"2�3���%�
��
8�%/��"�����d�n�n�&6�7�� �D�L�
8��
�
���$�
��
8�%/��"�����d�n�n�&6�7�s<�B8�#<D&�'C/�82C,�/2D#�&E7�/E�?E7�2E4�2E7c���|j}|�y|j||��ry|j}|r8|jj|g�}|D]}|j||��s�yy)NF)�ctx_callbackT)rr�implementsAnyFixturers�get)r"r�rrrs�	ancestors�ancestors      r�hasFixtureszContextSuite.hasFixtures�su���,�,���?���$�$�W�<�$�H���,�,������+�+�D�"�5�I�%���,�,��<�-�9��&�rc��t|�r|j|jz}nA|j|jz}t|d�r||j|jzz
}d}|D]}t||�s�d}n|�|S|||�S)N�__path__FT)r�
classSetup�
classTeardown�moduleSetup�moduleTeardown�hasattr�packageSetup�packageTeardown)r"rrr��names�fixt�ms      rr�z!ContextSuite.implementsAnyFixture�s����7���O�O�d�&8�&8�8�E��$�$�t�':�':�:�E��w�
�+���*�*�T�-A�-A�A�A�����A��w��"��������K��G�T�*�*rc���tjdt|�|j�|s tjdt|��y|jr tjdt|��y|j
}|�y|j}|r�|j
j|g�dd}|r_|j�}tjd|�||jvr�7tjd|�|j|�|r�_||jvr#|j|�n|j|�d|_tjd�y)Nz suite %s setUp called, tests: %szsuite %s has no testszsuite %s already set upzancestor %s may need setupzancestor %s does need setupTzcompleted suite setup)
r?r@r-r(�	was_setuprrrsr��pop�setupContext)r"rrrsr�r�s     rrezContextSuite.setUp
s���	�	�4�b��h����L���I�I�-�r�$�x�8���>�>��I�I�/��D��:���,�,���?���,�,������+�+�D�"�5�a�8�I��$�=�=�?���	�	�6��A��w�0�0�0���	�	�7��B��!�!�(�+�
��g�/�/�/��!�!�'�*����g�&�����	�	�)�*rc��|jjj|�tj	d||�|j
r2||j
jvry||j
j|<t|�r
|j}n'|j}t|d�r|j|z}t||�y)Nz%s setup context %sr�)
rt�plugins�startContextr?r@rsr�rr�r�r�r�r�r"rrr�s   rr�zContextSuite.setupContext-s��������(�(��1��	�	�'��w�7��<�<��$�,�,�0�0�0��/3�D�L�L�"�"�7�+��7���O�O�E��$�$�E��w�
�+��)�)�E�1�����rc�:�|j�yd|jzS)Nz
test suiteztest suite for %s�rrr)s r�shortDescriptionzContextSuite.shortDescription>s���<�<���"�T�\�\�1�1rc���tjd�|jr|jr1tjd|j�d|j�d��yd|_|j}|�tjd�y|j
}|r�|jj
|g�|gz}|D]�}tjd|�||jvrtjd|��>||jvrtjd	|��c|j|}tjd
||�||us��|j|���y|j|�y)Nzcontext teardownz"No reason to teardown (was_setup? z was_torndown? �)TzNo context to tear downzancestor %s may need teardownzancestor %s was not setupzancestor %s already torn downz%s setup ancestor %s)r?r@r��was_torndownrrrsr��teardownContext)r"rrrsr�r�rds      rrjzContextSuite.tearDownCs3���	�	�$�%��~�~��!2�!2��I�I��>�>�4�#4�#4�6�
7�
� ����,�,���?��I�I�/�0���,�,������+�+�D�"�5��	�A�I�%���	�	�9�8�D��7�#4�#4�4��I�I�9�8�D���w�3�3�3��I�I�=�x�H���)�)�(�3���	�	�0�%��B��D�=��(�(��2�&�
� � ��)rc��tjd||�|jr2||jjvry||jj|<t	|�r
|j
}n'|j}t|d�r|j|z}t||�|jjj|�y)Nz%s teardown context %sr�)
r?r@rsr�rr�r�r�r�rrtr��stopContextr�s   rr�zContextSuite.teardownContextds����	�	�*�D�'�:��<�<��$�,�,�3�3�3��15�D�L�L�%�%�g�.��7���&�&�E��'�'�E��w�
�+��,�,�u�4�����������'�'��0rc#��K�|j�D]U}t|t�st|tj�r|���2t||j
|j�����Wy�w)N�rtru)rFrHrrIrJrtrur7s  r�_get_wrapped_testszContextSuite._get_wrapped_teststsT�����O�O�%�D��$��%��D�(�:L�:L�)M��
��4�"&�+�+�'+�'7�'7�9�9�	&�s�A*A,zOAccess the tests in this suite. Tests are returned inside of a context wrapper.)rNNNNTr&)%rrrrrI�TestCase�failureExceptionr�r�r�r�r�r�r�r�r r.rOr-r2r�r�r�r=r�r�rer�r�rjr�r�rPrr!r(rQrRs@rrTrTzs����� �(�(�9�9���I��L�/�J�D�M��K�.�N�D�L�*�O�8<�:>�2�=��G��%�$��
�$8�L� +�"+�@ �"2�
*�B
1� 9��(�)�*>�*>��5�6�FrrTc�F�eZdZdZeZddefd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
y)
�ContextSuiteFactoryaCFactory for ContextSuites. Called with a collection of tests,
    the factory decides on a hierarchy of contexts by introspecting
    the collection or the tests themselves to find the objects
    containing the test objects. It always returns one suite, but that
    suite may consist of a hierarchy of nested suites.
    Nc��|�
t�}||_|�||_|turt	|��}||_i|_i|_i|_i|_	y)N)rt)
rrt�
suiteClass�_defrru�suitesrrr�r�)r"rtr�rus    rr zContextSuiteFactory.__init__�s[���>��X�F�����!�(�D�O��$��,�F�;�K�&��������������rc�l�tjd|�|jdt|dd��}tjd||�|�#|j	|�}	|j|�}|j||fi|��S#t$r&|j|j|�dfi|��cYSwxYw)a�Return ``ContextSuite`` for tests. ``tests`` may either
        be a callable (in which case the resulting ContextSuite will
        have no parent context and be evaluated lazily) or an
        iterable. In that case the tests will wrapped in
        nose.case.Test, be examined and the context of each found and a
        suite of suites returned, organized into a stack with the
        outermost suites belonging to the outermost contexts.
        zCreate suite for %srrNztests %s context %s)	r?r@r�r{�	wrapTests�findContextr�	makeSuite�mixedSuites)r"r#r�rrs    rr�zContextSuiteFactory.__call__�s���	�	�	�'��/��&�&��G�E�9�d�$C�D���	�	�'���8��?��N�N�5�)�E�
K��*�*�5�1���t�~�~�e�W�3��3�3��%�
K�%�t�~�~�d�&6�&6�u�&=�t�J�r�J�J�
K�s�B�,B3�2B3c#�K�tjd|�|�yt|d�r|jj}n"t|d�r|jj}t|d�r|j
j
d�}n9t|d�r|jj
d�dd}ntd	|z��|rGtjd
||�tdj|����|j�|r�Fyy�w)z�Return the ancestry of the context (that is, all of the
        packages and modules containing the context), in order of
        descent with the outermost ancestor last.
        This method is a generator.
        zget ancestry %sN�im_class�__self__rrr���z%s has no ancestors?z %s ancestors %s)r?r@r�r�r$r�splitr�	TypeErrorr�joinr�)r"rrr�s   r�ancestryzContextSuiteFactory.ancestry�s�����	�	�	�#�W�-��?���7�J�'��&�&�0�0�G�
�W�j�
)��&�&�0�0�G��7�L�)��*�*�0�0��5�I�
�W�j�
)��(�(�.�.�s�3�C�R�8�I��2�W�<�=�=���I�I�(�'�9�=��s�x�x�	�2�3�3��M�M�O��s�DD�
Dc���t|tj�st|tj�ryd}|D]-}t|dd�}|��|�|}�||k7s�t
d|�d|����|S)Nrrz-Tests with different contexts in same suite! z != )rHrKrLrIrJr{r)r"r#rrr8�ctxs     rr�zContextSuiteFactory.findContext�sx���e�[�1�1�2�j���HZ�HZ�6[�����D��$�	�4�0�C��{�������C��'���%�&�&���rc	�R�|j|f||j||jd�|��}|��|jj	|g�j|�|jj	|g�j|�tjd|t|dd��|j|�D]l}|jj	|g�j|�|j|j|�tjd||j��n|S)N)rrrtrsruzsuite %s has context %srzsuite %s has ancestor %s)r�rtrur��
setdefaultr6rrr?r@r{r�r)r"r#rrr��suiter�s      rr�zContextSuiteFactory.makeSuite�s�������0�"�4�;�;���(�(�0�,.�0�����K�K�"�"�7�B�/�6�6�u�=��L�L�#�#�E�2�.�5�5�g�>��I�I�/���g�z�4�8�
:� �M�M�'�2�����&�&�x��4�;�;�E�B����U�#�*�*�8�4��	�	�4�e�X�=N�=N�O�3��rc�&�|sgS|jd�}|s|gS|}|dd}t|dd�}|��|g|j|�D�cgc]}|��c}z}|D]�}|g}	g}
|D]~}d}t|dd�}
|
�|
j|��&|
|ur|	j|��<|j|
�D]}||us�|	j|�d}n|r�n|
j|���|	r|j	|	|�}|j|
�}��|g|zScc}w)acThe complex case where there are tests that don't all share
        the same context. Groups tests into suites with common ancestors,
        according to the following (essentially tail-recursive) procedure:

        Starting with the context of the first test, if it is not
        None, look for tests in the remaining tests that share that
        ancestor. If any are found, group into a suite with that
        ancestor as the context, and replace the current suite with
        that suite. Continue this process for each ancestor of the
        first test, until all ancestors have been processed. At this
        point if any tests remain, recurse with those tests as the
        input, returning a list of the common suite (which may be the
        suite or test we started with, if no common tests were found)
        plus the results of recursion.
        rNrrFT)r�r{r�r6r�r�)r"r#�headr��tailrr�ar�r��common�remainr8�found_common�test_ctx�
test_ancestors               rr�zContextSuiteFactory.mixedSuites�sD�� ��I��y�y��|����6�M����Q�x���$�	�4�0���� �	��
�
�g�0F�$G�0F�1�Q�0F�$G�G�I�%������� �D�#(�L�&�t�Y��=�H��'��
�
�d�+� ��8�+��
�
�d�+� �)-���x�)@�
�(�H�4�"�M�M�$�/�+/�L�!�	*A�
(��
�
�d�+�!� � �N�N�6�8�<�E��'�'��/��+&�,�w��~���/%Hs�	Dc�Z�tjd|�t|tj�st|t
j�rtjd�|Sg}|D]�}tjd|�t|t�st|t
j�r|j|��Ut|t�r-|j|j||j�����|jt||j|j�����|S)Nzwrap %szI won't wrapzwrapping %sr�r�)r?r@rHrKrLrIrJrr6�ContextListr�rrrtru)r"r#�wrappedr8s    rr�zContextSuiteFactory.wrapTestss����	�	�)�U�#��e�[�1�1�2�j���HZ�HZ�6[��I�I�n�%��L����D��I�I�m�T�*��$��%��D�(�:L�:L�)M����t�$��D�+�.����t�~�~�d�D�L�L�~�I�J������d�k�k�t�?O�?O�P����r)rrrrrTr�r�r r�r�r�r�r�r�rrrr�r��s9����J�"�t��� 4�(�6�"
�0�drr�c��eZdZdZdd�Zd�Zy)r�z�Not quite a suite -- a group of tests in a context. This is used
    to hint the ContextSuiteFactory about what context the tests
    belong to, in cases where it may be ambiguous or missing.
    Nc� �||_||_yr&)r#rr)r"r#rrs   rr zContextList.__init__3s����
���rc�,�t|j�Sr&)r'r#r)s rr*zContextList.__iter__7����D�J�J��rr&)rrrrr r*rrrr�r�.s���� rr�c�4��eZdZdZ�fd�Zd�Zd�Zd�Z�xZS)�FinalizingSuiteWrapperz�Wraps suite and calls final function after suite has
    executed. Used to call final functions in cases (like running in
    the standard test runner) where test running is not under nose's
    control.
    c�F��tt|��||_||_yr&)rr�r r��finalize)r"r�r�r$s   �rr zFinalizingSuiteWrapper.__init__As���
�$�d�4�6���
� ��
rc�&�|j|i|��Sr&r�r�s   rr�zFinalizingSuiteWrapper.__call__Fr�rc�,�t|j�Sr&)r'r�r)s rr*zFinalizingSuiteWrapper.__iter__Jr�rc�z�	|j|i|��|j|i|��S#|j|i|��wxYwr&)r�r�r�s   rr=zFinalizingSuiteWrapper.runMsA��	&��4�:�:�s�)�b�)��D�M�M�3�%�"�%��M�D�M�M�3�%�"�%�s�&�:)	rrrrr r�r*r=rQrRs@rr�r�;s����
!�
$� �&rr�c��eZdZd�Zy)�TestDirc��td��)Nz�TestDir is not usable with nose 0.10. The class is present in nose.suite for backwards compatibility purposes but it may not be used.��NotImplementedError�r�r�s  rr zTestDir.__init__V���!�
� �	 rN�rrrr rrrr�r�U��� rr�c��eZdZd�Zy)�
TestModulec��td��)Nz�TestModule is not usable with nose 0.10. The class is present in nose.suite for backwards compatibility purposes but it may not be used.r�r�s  rr zTestModule.__init__^r�rNr�rrrr�r�]r�rr�)%r�loggingr�rI�	nose.caser�nose.configr�
nose.proxyr�	nose.utilrrrrKr��version_info�clr�AddReference�IronPython.Runtime.Exceptionsr
�	Exception�	getLoggerrr?r1r�rrrJrrTr�r�r�r�r�rrr�<module>rs�����
����)�4�4���<�<�5��
������f�$�������&�A�	�i�	��g����!���x��4�	�	�	�HH��"�"�HH�VE6�9�E6�Pi�&�i�X
 �&�
 �&�X�/�/�&�4 � � � r

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic