%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/trial/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/trial/test/__pycache__/test_runner.cpython-312.pyc

�

Ϫ�f�}��N�ddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZddlmZdd	lmZmZmZdd
lmZddlmZddlmZdd
lmZmZmZm Z ddl!m"Z"ddl#m$Z$m%Z%Gd�d�Z&e
e$�Gd�d��Z'Gd�d�Z(Gd�de(ejR�Z*Gd�de(ejR�Z+Gd�d�Z,Gd�de,ejR�Z-Gd�de,ejR�Z.Gd �d!e,ejR�Z/Gd"�d#ejR�Z0Gd$�d%ejR�Z1Gd&�d'ejR�Z2Gd(�d)e2�Z3Gd*�d+ejh�Z5Gd,�d-ejR�Z6Gd.�d/ejR�Z7Gd0�d1�Z8Gd2�d3e8e7�Z9Gd4�d5e8e7�Z:Gd6�d7ejR�Z;Gd8�d9ejR�Z<Gd:�d;ejR�Z=Gd<�d=ejR�Z>Gd>�d?ejR�Z?y)@�N)�StringIO)�List)�implementer)�verifyObject)�plugin)�defer)�
twisted_trial)�failure�log�reflect)�FilePath��namedAny)�trial)�reporter�runner�unittest�util)� _ForceGarbageCollectionDecorator)�	IReporter�	ITestCasec��eZdZd�Zd�Zy)�CapturingDebuggerc��g|_y�N)�_calls��selfs �@/usr/lib/python3/dist-packages/twisted/trial/test/test_runner.py�__init__zCapturingDebugger.__init__s	�����c�V�|jjd�|d|ddi|��y)N�runcallr��r�append)r�args�kwargss   rr#zCapturingDebugger.runcall"s-�������9�%���Q���a�b��$�V�$r!N)�__name__�
__module__�__qualname__r r#�r!rrrs���%r!rc�r�eZdZdZdZdZdZdZdZdd�Z	d�Z
d�Zd�Zd�Z
d�Zd	�Zd
�Zdd�Zdd�Zd
�Zd�Zy)�CapturingReporterzC
    Reporter that keeps a log of all actions performed on it.
    Nc�X�g|_d|_||_||_||_||_y)z.
        Create a capturing reporter.
        FN)r�
shouldStop�_stream�	_tbformat�	_rterrors�
_publisher)r�stream�tbformat�rterrors�	publishers     rr zCapturingReporter.__init__3s.�����������!���!���#��r!c�:�|jjd�y)z�
        Report the beginning of a run of a single test method
        @param method: an object that is adaptable to ITestMethod
        �	startTestNr%�r�methods  rr:zCapturingReporter.startTest>s��
	
�����;�'r!c�:�|jjd�y)z}
        Report the status of a single test method
        @param method: an object that is adaptable to ITestMethod
        �stopTestNr%r;s  rr>zCapturingReporter.stopTestEs��
	
�����:�&r!c�:�|jjd�y)z�called when the reactor has been left in a 'dirty' state
        @param errs: a list of L{twisted.python.failure.Failure}s
        �cleanupErrorNr%)r�errss  r�
cleanupErrorszCapturingReporter.cleanupErrorsLs��	
�����>�*r!c�:�|jjd�y)N�
addSuccessr%�r�tests  rrDzCapturingReporter.addSuccessRs�������<�(r!c��y)z@
        Do nothing. These tests don't care about done.
        Nr,rs r�donezCapturingReporter.doneU��r!c��y)zD
        Do nothing. These tests don't care about addError.
        Nr,�rrF�errors   r�addErrorzCapturingReporter.addErrorZrIr!c��y)zF
        Do nothing. These tests don't care about addFailure.
        Nr,)rrFr
s   r�
addFailurezCapturingReporter.addFailure_rIr!c��y)zN
        Do nothing. These tests don't care about addExpectedFailure.
        Nr,)rrFr
�todos    r�addExpectedFailurez$CapturingReporter.addExpectedFailuredrIr!c��y)zP
        Do nothing. These tests don't care about addUnexpectedSuccess.
        Nr,)rrFrQs   r�addUnexpectedSuccessz&CapturingReporter.addUnexpectedSuccessirIr!c��y)zC
        Do nothing. These tests don't care about addSkip.
        Nr,)rrF�reasons   r�addSkipzCapturingReporter.addSkipnrIr!c��y)zI
        Do nothing. These tests don't care about wasSuccessful.
        Nr,rs r�
wasSuccessfulzCapturingReporter.wasSuccessfulsrIr!)NNNNr)r)r*r+�__doc__r5r6r'�	separator�testsRunr r:r>rBrDrHrMrOrRrTrWrYr,r!rr.r.'s^����F��H��D��I��H�	$�(�'�+�)��
�
�
�
�
�
r!r.c�(�eZdZdZd�Zd�Zd�Zd�Zy)�TrialRunnerTestsMixinz9
    Mixin defining tests for L{runner.TrialRunner}.
    c��y)z=
        Empty test method, used by the other tests.
        Nr,rs r�
test_emptyz TrialRunnerTestsMixin.test_empty~rIr!c�6�tjjSr)r�theLogPublisher�	observersrs r�
_getObserversz#TrialRunnerTestsMixin._getObservers�s���"�"�,�,�,r!c���t|j��}|jj|j�t|j��}|j||�y)zn
        Any log system observers L{TrialRunner.run} adds are removed by the
        time it returns.
        N)�lenrdr�runrF�assertEqual)r�
originalCount�newCounts   r�test_addObserversz'TrialRunnerTestsMixin.test_addObservers�sN��
�D�.�.�0�1�
�������	�	�"��t�)�)�+�,������=�1r!c�p�t|jj�j|jj�}td�D]f}|jj
|j�|j�|j|j��|j��hy)z=
        Test that a new file is opened on each run.
        �N)r
r�workingDirectory�child�logfile�rangergrF�restat�
assertTrue�exists�remove)r�logPath�is   r�test_logFileAlwaysActivez.TrialRunnerTestsMixin.test_logFileAlwaysActive�s}���4�;�;�7�7�8�>�>�t�{�{�?R�?R�S���q��	�A��K�K�O�O�D�I�I�&��N�N���O�O�G�N�N�,�-�
�N�N��
	r!N)r)r*r+rZr`rdrkrxr,r!rr^r^ys����
-�2�r!r^c��eZdZdZd�Zd�Zy)�TrialRunnerTestszm
    Tests for L{runner.TrialRunner} with the feature to turn unclean errors
    into warnings disabled.
    c��t�|_tjt|j��|_td�|_y)N�r5r`�rr5r�TrialRunnerr.rzrFrs r�setUpzTrialRunnerTests.setUp�s0���j����(�(�):�4�;�;�O���$�\�2��	r!c�x�|jj�}|j|jt�y)z�
        The reporter constructed by L{runner.TrialRunner} is passed
        L{twisted.python.log} as the value for the C{publisher} parameter.
        N)r�_makeResult�assertIdenticalr4r�r�results  r�test_publisherzTrialRunnerTests.test_publisher�s,��
���(�(�*�����V�.�.��4r!N)r)r*r+rZrr�r,r!rrzrz�s���
3�
5r!rzc��eZdZdZd�Zy)�+TrialRunnerWithUncleanWarningsReporterTestsza
    Tests for the TrialRunner's interaction with an unclean-error suppressing
    reporter.
    c��t�|_tjt|jd��|_td�|_y)NT�r5�uncleanWarningsr`r}rs rrz1TrialRunnerWithUncleanWarningsReporterTests.setUp�s6���j����(�(��d�k�k�4�
���%�\�2��	r!N�r)r*r+rZrr,r!rr�r��s���
3r!r�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�DryRunMixinze
    Mixin for testing that 'dry run' mode works with various
    L{pyunit.TestCase} subclasses.
    c���g|_t�|_tjt
tjj|j��|_|j�y)Nr|)rrr5rr~r.�DRY_RUN�makeTestFixturesrs rrzDryRunMixin.setUp�sI������j����(�(��v�1�1�9�9�$�+�+�
���	
���r!c��y)zh
        Set C{self.test} and C{self.suite}, where C{self.suite} is an empty
        TestSuite.
        Nr,rs rr�zDryRunMixin.makeTestFixtures�rIr!c��|jjtj��}|j|jg�y)zf
        If there are no tests, the reporter should not receive any events to
        report.
        N)rrg�	TestSuiterhrr�s  rr`zDryRunMixin.test_empty�s3��
������!1�!1�!3�4���������+r!c��|jj|j�}|j|jgd��y)z�
        If we are running a single test, check the reporter starts, passes and
        then stops the test during a dry run.
        �r:rDr>N)rrgrFrhrr�s  r�test_singleCaseReportingz$DryRunMixin.test_singleCaseReporting�s/��
��������+��������(O�Pr!c��|jj|j�|j|jg�y)zT
        When we are doing a dry run, the tests should not actually be run.
        N)rrgrFrhrrs r�test_testsNotRunzDryRunMixin.test_testsNotRun�s,��	
������	�	�"�������2�&r!N)	r)r*r+rZrr�r`r�r�r,r!rr�r��s!���
 ��,�Q�'r!r�c��eZdZdZd�Zy)�SynchronousDryRunTestszS
    Check that 'dry run' mode works well with trial's L{SynchronousTestCase}.
    c��Gd�dtj�}|d�|_tj�|_y)Nc��eZdZd�Zy)�;SynchronousDryRunTests.makeTestFixtures.<locals>.PyunitCasec��yrr,rs r�test_foozDSynchronousDryRunTests.makeTestFixtures.<locals>.PyunitCase.test_foo����r!N�r)r*r+r�r,r!r�
PyunitCaser�����
r!r�r�)r�SynchronousTestCaserF�pyunitr��suite�rr�s  rr�z'SynchronousDryRunTests.makeTestFixtures�s2��	��5�5�	��z�*��	��%�%�'��
r!N�r)r*r+rZr�r,r!rr�r������(r!r�c��eZdZdZd�Zy)�DryRunTestsz@
    Check that 'dry run' mode works well with Trial tests.
    c���G�fd�dtj�}|d��_tj��_y)Nc���eZdZ�fd�Zy)�.DryRunTests.makeTestFixtures.<locals>.MockTestc�<���jjd�y)Nr�)rr&)rFrs �rr�z7DryRunTests.makeTestFixtures.<locals>.MockTest.test_foos��������
�+r!Nr�rs�r�MockTestr�s���
,r!r�r�)r�TestCaserFrr�r�)rr�s` rr�zDryRunTests.makeTestFixturess3���	,�x�(�(�	,��Z�(��	��%�%�'��
r!Nr�r,r!rr�r��r�r!r�c��eZdZdZd�Zy)�PyUnitDryRunTestszJ
    Check that 'dry run' mode works well with stdlib unittest tests.
    c��Gd�dtj�}|d�|_tj�|_y)Nc��eZdZd�Zy)�6PyUnitDryRunTests.makeTestFixtures.<locals>.PyunitCasec��yrr,rs rr�z?PyUnitDryRunTests.makeTestFixtures.<locals>.PyunitCase.test_foor�r!Nr�r,r!rr�r�r�r!r�r�)r�r�rFr�r�r�s  rr�z"PyUnitDryRunTests.makeTestFixturess0��	����	��z�*��	��%�%�'��
r!Nr�r,r!rr�r�r�r!r�c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Ze�Zd�Zd�Zy)�RunnerTestsc�X���tj��_tjt
�j
d�}dj|dd�}|d}tjd|ddd|��g���fd�}tj�_|t_gd�d	z�_
y)
N�.���zTest Helper ReporterzUtility for unit testing.�	capturing)�description�longOpt�shortOpt�klassc�t���j|t��t�j|g|��i|���zSr)rhr�list�original)�iface�a�kw�pluginsrs   ��r�
getPluginsz%RunnerTests.setUp.<locals>.getPlugins/s8������U�I�.��T�-�$�-�-��"@��"@�R�"@�A�A�Ar!r��
)r�Options�configr�qualr.�split�joinr	�	_Reporterrr�r��standardReport)r�parts�packager�r�r�s`    @rrzRunnerTests.setUps�����m�m�o������.�/�5�5�c�:���(�(�5��"�:�&���b�	���#�#�&��7�#���

�	
��	B��)�)��
�&���
F��J��r!c�.�|jt_yr)r�rr�rs r�tearDownzRunnerTests.tearDown;s�� �M�M��r!c�:�|jj|�yr)r��parseOptions�rr's  rr�zRunnerTests.parseOptions>s����� � ��&r!c�b�tj|j�}t�|_|Sr)r�_makeRunnerr�rr5)r�rs  r�	getRunnerzRunnerTests.getRunnerAs$�����d�k�k�*���:����r!c��|jg�|jd}|j�}|j||j�j
�y�Nr)r�r�r�rhr��	__class__)rr�rs   r�test_runner_can_get_reporterz(RunnerTests.test_runner_can_get_reporterFsL�����"�����Z�(�����!������!3��!3�!3�!5�!?�!?�@r!c��|jg�|j�}|j�}|j|j|j
d�yr�)r�r�r�rhr�r��rrr�s   r�test_runner_get_resultz"RunnerTests.test_runner_get_resultLsK�����"�����!��#��#�#�%������)�)�4�;�;�z�+B�Cr!c��|jg�|j�}|j|j�tj
�y)z�
        By default Trial sets the 'uncleanWarnings' option on the runner to
        False. This means that dirty reactor errors will be reported as
        errors. See L{test_reporter.DirtyReactorTests}.
        N)r�r��assertNotIsInstancer�r�UncleanWarningsReporterWrapper�rrs  r� test_uncleanWarningsOffByDefaultz,RunnerTests.test_uncleanWarningsOffByDefaultRsB��	
���"�����!��� � ��F��� �(�"I�"I�	
r!c��|jdg�|j�}|j|j�tj
�y)z�
        Specifying '--unclean-warnings' on the trial command line will cause
        reporters to be wrapped in a device which converts unclean errors to
        warnings.  See L{test_reporter.DirtyReactorTests} for implications.
        z--unclean-warningsN)r�r��assertIsInstancer�rr�r�s  r�test_getsUncleanWarningsz$RunnerTests.test_getsUncleanWarnings^sF��	
���/�0�1����!������F��� �(�"I�"I�	
r!c��|jddg�|j�}|j|jd�y)N�--temp-directory�	some_path)r�r�rhrnr�s  r�test_runner_working_directoryz)RunnerTests.test_runner_working_directoryjs8�����-�{�;�<����!������0�0�+�>r!c�������|jg�|jtjtj��t|j
����j�tj�j�|j�}|j��i�G����fd�dtj��|j�d��}|j|jz}|r|j|dd�|j!��j#d�j�j#d�jd��y	)
z�
        If no working directory is explicitly specified and the default
        working directory is in use by another runner, L{TrialRunner.run}
        selects a different default working directory to use.
        c�(��eZdZ����fd�Z�fd�Zy)�KRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCasec����tj�x�d<}tj�j�|j	tj|��j�d��y)z�
                Start a second test run which will have a default working
                directory which is the same as the working directory of the
                test run already in progress.
                �
concurrent�test_secondN)�os�getcwd�chdir�path�
addCleanuprg)r�subsequentDirectory�ConcurrentCase�runDirectory�secondRunner�wheres  ����r�
test_firstzVRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCase.test_first�sS���=?�I�I�K�G��l�#�&9�����*�*�+�������*=�>�� � ��
�!>�?r!c�4��tj��d<y)zR
                Record the working directory for later analysis.
                �recordN)r�r�)rr�s �rr�zWRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCase.test_second�s���#%�)�)�+��h�r!N)r)r*r+rr�)r�r�r�r�s����rr�r��s���
@�
.r!r�rrr$�_trial_tempz
_trial_temp-1)r�rN)r�r�r�r�r�r
�mktemp�makedirsr�r�rr�rg�errors�failures�failrhro)r�firstRunnerr��badr�r�r�r�s    @@@@r�'test_concurrentImplicitWorkingDirectoryz3RunnerTests.test_concurrentImplicitWorkingDirectoryos
���	
���"��	
������"�)�)�+�.�
 ����
�.������
����"�"�#��n�n�&���~�~�'����	.�	.�X�9�9�	.�*�����!=�>���m�m�f�o�o�-����I�I�c�!�f�Q�i� �����*�0�0��?�D�D�&�,�,�_�=�B�B�
�	
r!c����|jdtjj|j	��g�tj
�}|j
tj|�|j�}|j��G��fd�dtj��|j�d��}|j|jz}|r|j|dd�yy)z�
        If a working directory which is already in use is explicitly specified,
        L{TrialRunner.run} raises L{_WorkingDirectoryBusy}.
        r�c� ��eZdZ��fd�Zd�Zy)�KRunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCasec�h��|jtj�j�d��y)z�
                Try to start another runner in the same working directory and
                assert that it raises L{_WorkingDirectoryBusy}.
                �test_failureN)�assertRaisesr�_WorkingDirectoryBusyrg)rr�r�s ��r�test_concurrentz[RunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCase.test_concurrent�s-���
�!�!��.�.� �$�$�"�>�2�r!c�&�|jd�y)zE
                Should not be called, always fails.
                z$test_failure should never be called.N)rrs rrzXRunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCase.test_failure�s���	�	�@�Ar!N)r)r*r+rr)r�r�s��rr�r�s���	
�
Br!r�rrr$N)r�r�r��abspathrr�r�r�r�rr�rgrrr)r�initialDirectoryr	r�r
r�r�s     @@r�'test_concurrentExplicitWorkingDirectoryz3RunnerTests.test_concurrentExplicitWorkingDirectory�s����
	
���-�r�w�w���t�{�{�}�/M�N�O��9�9�;��������"2�3��n�n�&���~�~�'��	B�X�9�9�	B�$����0A�!B�C���m�m�f�o�o�-����I�I�c�!�f�Q�i� �r!c�&�|jd|j�dddg�|j�}tj�}|jdd�}|j
|�}|j|j|j�y)Nr��
--reporterr��twisted.trial.test.sampleT)
r�rr�r�
TestLoader�
loadByNamergrhr�r)r�	my_runner�loaderr�r�s     r�test_runner_normalzRunnerTests.test_runner_normal�s������"����
���+�
�	
��N�N�$�	��"�"�$���!�!�"=�t�D�����u�%������,�,�f�m�m�<r!c�p�tj�}|jdd�}|j|�S)NrT)rrrrg)rrrr�s    r�runSampleSuitezRunnerTests.runSampleSuite�s2���"�"�$���!�!�"=�t�D���}�}�U�#�#r!c��|jgd��|j�}t�x}|_|j	|�}|j|j|j�|jdg|j�y)zL
        Trial uses its debugger if the `--debug` option is passed.
        )rr��--debugrr#N)r�r�r�debuggerr!rhr�r)rrr$r�s    r�test_runnerDebugzRunnerTests.test_runnerDebug�ss��	
���O�	
��N�N�$�	�(9�(;�;��9�%��$�$�Y�/������,�,�f�m�m�<����)��h�o�o�6r!c�0���jddg�td�}|j�d�_�fd�}�j	t
jd|��j�j���j�j�y)zL
        Trial uses pdb if no debugger is specified by `--debugger`
        r#r�pdbrcFc���d�_y�NT��runcall_called��pdbr�r�rs   �rr#z=RunnerTests.test_runnerDebuggerDefaultsToPdb.<locals>.runcall�����"&�D�r!r#N)
r�r
�touchr+�patchr-�Pdbr!r�rs)r�	pdbrcFiler#s`  r� test_runnerDebuggerDefaultsToPdbz,RunnerTests.test_runnerDebuggerDefaultsToPdb�sw���	
���9�&A�B�C��W�%�	�����#���	'�	
�
�
�3�7�7�I�w�/����D�N�N�,�-�����+�+�,r!c����jgd��d�_�fd�}�jtjd|��j�j
���j�j�y)zU
        Trial uses pdb if pdb is passed explicitly to the `--debugger` arg.
        )rr��
--debuggerr-r#rFc���d�_yr)r*r,s   �rr#zGRunnerTests.test_runnerDebuggerWithExplicitlyPassedPdb.<locals>.runcallr.r!r#N)r�r+r0r-r1r!r�rs)rr#s` r�*test_runnerDebuggerWithExplicitlyPassedPdbz6RunnerTests.test_runnerDebuggerWithExplicitlyPassedPdbsd���	
���
�		
�$���	'�	
�
�
�3�7�7�I�w�/����D�N�N�,�-�����+�+�,r!c��|jgd��|j�}|j|�}|j|j|j
�|jdg|jj
�y)zM
        Trial uses specified debugger if the debugger is available.
        )rr�r5z4twisted.trial.test.test_runner.RunnerTests.cdebuggerr#rr#N)r�r�r!rhr�rr$)rrr�s   r�test_runnerDebuggerzRunnerTests.test_runnerDebuggersm��	
���
�		
��N�N�$�	��$�$�Y�/������,�,�f�m�m�<����)��i�&8�&8�&?�&?�@r!c��|jdg�|j�}|j�}|j|tj
�y)z�
        If trial was passed the C{--exitfirst} option, the constructed test
        result object is wrapped with L{reporter._ExitWrapper}.
        z--exitfirstN)r�r�r�r�r�_ExitWrapperr�s   r�test_exitfirstzRunnerTests.test_exitfirst0sF��
	
���=�/�*����!��#��#�#�%�����f�h�&;�&;�<r!N)r)r*r+rr�r�r�r�r�r�r�r�rrrr!r%r3r7r�	cdebuggerr9r<r,r!rr�r�sm��K�B*�'��
A�D�

�

�?�
7
�r"!�H=� $�
7�-�&-�4"�#�I�A�&=r!r�c��eZdZd�Zy)�TrialSuiteTestsc��td�y)Nztwisted.trial.runner.TrialSuiterrs r�test_importszTrialSuiteTests.test_imports<s���2�3r!N)r)r*r+rAr,r!rr?r?;s��4r!r?c�T�eZdZGd�dej�Zd�Zd�Zd�Zd�Z	d�Z
y)	�UntilFailureTestsc�,�eZdZUdZgZeded<d�Zy)�UntilFailureTests.FailAfterzC
        A test case that fails when run 3 times in a row.
        N�countc��|jjd�t|j�dk(r|jd�yy)N�zCount reached 3)rFr&rfrrs rr�z$UntilFailureTests.FailAfter.test_fooIs6���J�J���d�#��4�:�:��!�#��	�	�+�,�$r!)r)r*r+rZrFr�__annotations__r�r,r!r�	FailAfterrEBs��	���t�D�z��	-r!rJc���gtj_tjd�|_t	�|_t
jtj|j
��|_y)Nr�r|)
rCrJrFrFrr5rr~r�Reporterrs rrzUntilFailureTests.setUpNsJ��,.��#�#�)�%�/�/�
�;��	��j����(�(��):�):�4�;�;�O��r!c��|jj|j�}|j|jd�|j|j
��|j|j|�d�y)zl
        Test that the runUntilFailure method of the runner actually fail after
        a few runs.
        r$N)r�runUntilFailurerFrhr\�assertFalserY�_getFailuresr�s  r�test_runUntilFailurez&UntilFailureTests.test_runUntilFailureTsb��
���,�,�T�Y�Y�7��������!�,�����-�-�/�0�����*�*�6�2�A�6r!c�,�t|j�S)zL
        Get the number of failures that were reported to a result.
        )rfrr�s  rrPzUntilFailureTests._getFailures^s���6�?�?�#�#r!c�@��g��fd�}|jtd|�|jj|j�}|j|jd�|jt��d�|j�|jtfg�y)z�
        C{runUntilFailure} doesn't decorate the tests uselessly: it does it one
        time when run starts, but not at each turn.
        c�.���j||f�|Sr�r&�rF�	interface�	decorateds  �r�decoratez@UntilFailureTests.test_runUntilFailureDecorate.<locals>.decoratek�������d�I�.�/��Kr!rYr$N)	r0rrrNrFrhr\rfr�rrYr�rXs   @r�test_runUntilFailureDecoratez.UntilFailureTests.test_runUntilFailureDecorateds}���
�	�	�	
�
�
�8�Z��2����,�,�T�Y�Y�7��������!�,�����Y���+�����d�i�i��%;�$<�=r!c���g��fd�}|jtd|�d|j_|jj	|j
�}|j
|jd�|j
t��d�|j
�|j
tf|j
tfg�y)z�
        C{runUntilFailure} applies the force-gc decoration after the standard
        L{ITestCase} decoration, but only one time.
        c�.���j||f�|SrrUrVs  �rrYzGUntilFailureTests.test_runUntilFailureForceGCDecorate.<locals>.decorate}rZr!rYTr$rmN)r0rr�_forceGarbageCollectionrNrFrhr\rfrrr[s   @r�#test_runUntilFailureForceGCDecoratez5UntilFailureTests.test_runUntilFailureForceGCDecoratevs����
�	�	�	
�
�
�8�Z��2�.2����+����,�,�T�Y�Y�7��������!�,�����Y���+������i�i��
#�d�i�i�1Q�%R�S�	
r!N)r)r*r+r�r�rJrrQrPr\r`r,r!rrCrCAs,��
-�F�O�O�
-�P�7�$�>�$
r!rCc��eZdZdZd�Zd�Zy)�UncleanUntilFailureTestszh
    Test that the run-until-failure feature works correctly with the unclean
    error suppressor.
    c��tj|�tjtj
|jd��|_y)NTr�)rCrrr~rrLr5rs rrzUncleanUntilFailureTests.setUp�s3������%��(�(����d�k�k�4�
��r!c�@�t|jj�S)z�
        Get the number of failures that were reported to a result that
        is wrapped in an UncleanFailureWrapper.
        )rf�_originalReporterrr�s  rrPz%UncleanUntilFailureTests._getFailures�s��
�6�+�+�4�4�5�5r!N)r)r*r+rZrrPr,r!rrbrb�s���

�6r!rbc��eZdZdZd�Zy)�
BreakingSuitez;
    A L{TestSuite} that logs an error when it is run.
    c��	td��#t$r*tjtj��YywxYw)Nz#error that occurs outside of a test)�RuntimeErrorr�errr
�Failurer�s  rrgzBreakingSuite.run�s5��	'��D�E�E���	'��G�G�G�O�O�%�&�	'�s�
�0A�AN)r)r*r+rZrgr,r!rrgrg�s���'r!rgc�"�eZdZdZd�Zd�Zd�Zy)�LoggedErrorsTestsa

    It is possible for an error generated by a test to be logged I{outside} of
    any test. The log observers constructed by L{TestCase} won't catch these
    errors. Here we try to generate such errors and ensure they are reported to
    a L{TestResult} object.
    c�.�|jt�yr)�flushLoggedErrorsrirs rr�zLoggedErrorsTests.tearDown�s�����|�,r!c�l�tj�}|j|j�d�y)zg
        Check that we can construct a L{runner.LoggedSuite} and that it
        starts empty.
        rN)r�LoggedSuiterh�countTestCases)rr�s  r�test_constructz LoggedErrorsTests.test_construct�s+��
�"�"�$������-�-�/��3r!c��tj�}tjt	�g�}|j|�|j
t|j�d�|j
|jddj�tj�|j|jddjt��y)zU
        Chek that a L{LoggedSuite} reports any logged errors to its result.
        r$rN)r�
TestResultrrqrgrgrhrfr�id�NOT_IN_TESTrs�checkri)rr�r�s   r�test_capturesErrorz$LoggedErrorsTests.test_capturesError�s����$�$�&���"�"�M�O�#4�5��
�	�	�&������V�]�]�+�Q�/�������q�)�!�,�/�/�1�6�3E�3E�F�����
�
�a�(��+�1�1�,�?�@r!N)r)r*r+rZr�rsryr,r!rrmrm�s���-�4�	Ar!rmc�$�eZdZd�Zd�Zd�Zd�Zy)�TestHolderTestsc�Z�d|_tj|j�|_y�Nr�)r�r�
TestHolder�holderrs rrzTestHolderTests.setUp�s"��(����'�'��(8�(8�9��r!c���|j|jj�|j�|j|jj	�|j�y)z�
        Check that L{runner.TestHolder} takes a description as a parameter
        and that this description is returned by the C{id} and
        C{shortDescription} methods.
        N)rhrrvr��shortDescriptionrs r�test_holderzTestHolderTests.test_holder�sH��	
��������)�4�+;�+;�<�������5�5�7��9I�9I�Jr!c���|j|jt|j��|jt	t|j�|j�dt�d��y)z?
        L{runner.TestHolder} implements L{ITestCase}.
        z claims to provide z but does not do so correctly.N)r�rrrsrrs r�test_holderImplementsITestCasez.TestHolderTests.test_holderImplementsITestCase�sI��	
���T�[�[�)�D�K�K�*@�A������D�K�K�0��{�{�I�
'�	
r!c���tj�}|jj|�|j	|j��|j
d|j�y)zc
        A L{runner.TestHolder} can run against the standard Python
        C{TestResult}.
        r$N)r�rurrgrsrYrhr\r�s  r�test_runsWithStandardResultz+TestHolderTests.test_runsWithStandardResult�sK��
�"�"�$�������������,�,�.�/�����F�O�O�,r!N)r)r*r+rr�r�r�r,r!rr{r{�s��:�K�	
�-r!r{c�R�eZdZdZed�ZGd�d�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�ErrorHolderTestsMixinaa
    This mixin defines test methods which can be applied to a
    L{runner.ErrorHolder} constructed with either a L{Failure} or a
    C{exc_info}-style tuple.

    Subclass this and implement C{setUp} to create C{self.holder} referring to a
    L{runner.ErrorHolder} instance and C{self.error} referring to a L{Failure}
    which the holder holds.
    z"integer division or modulo by zeroc�(�eZdZdZd�Zd�Zd�Zd�Zy)�$ErrorHolderTestsMixin.TestResultStubz)
        Stub for L{TestResult}.
        c��g|_yr)rrs rr z-ErrorHolderTestsMixin.TestResultStub.__init__s	���D�Kr!c��yrr,rEs  rr:z.ErrorHolderTestsMixin.TestResultStub.startTest���r!c��yrr,rEs  rr>z-ErrorHolderTestsMixin.TestResultStub.stopTestr�r!c�>�|jj||f�yr)rr&rKs   rrMz-ErrorHolderTestsMixin.TestResultStub.addErrors���K�K����e�}�-r!N)r)r*r+rZr r:r>rMr,r!r�TestResultStubr��s��	�	�	�	�	.r!r�c���tj�}|jj|�|j	|j��|j
d|j�y)zd
        A L{runner.ErrorHolder} can run against the standard Python
        C{TestResult}.
        r$N)r�rurrgrOrYrhr\r�s  rr�z1ErrorHolderTestsMixin.test_runsWithStandardResultsM��
�"�"�$�������������-�-�/�0�����F�O�O�,r!c�2�|jj|j�|j|jj|j|j
j|j
j|j
jffg�y)zM
        L{runner.ErrorHolder} adds an error to the result when run.
        N)	rrgr�rhrrL�type�value�tbrs r�test_runzErrorHolderTestsMixin.test_runsc��	
��������$�����K�K����k�k�D�J�J�O�O�T�Z�Z�-=�-=�t�z�z�}�}�M�
N�O�	
r!c��|j|j�|j|jj|j|jj
|jj|jjffg�y)zP
        L{runner.ErrorHolder} adds an error to the result when called.
        N)rr�rhrrLr�r�r�rs r�	test_callzErrorHolderTestsMixin.test_call"s_��	
���D�K�K� �����K�K����k�k�D�J�J�O�O�T�Z�Z�-=�-=�t�z�z�}�}�M�
N�O�	
r!c�X�|j|jj�d�y)zH
        L{runner.ErrorHolder.countTestCases} always returns 0.
        rN)rhrrrrs r�test_countTestCasesz)ErrorHolderTestsMixin.test_countTestCases,s!��	
������3�3�5�q�9r!c��djt|jjd��}|j	t|j�|�y)zh
        L{runner.ErrorHolder.__repr__} returns a string describing the error it
        holds.
        z0<ErrorHolder description='description' error={}>r$N)�format�reprrrLrh)r�expecteds  r�	test_reprzErrorHolderTestsMixin.test_repr2sG��
I�O�O�����"�"�1�%�&�
��	
����d�k�k�*�H�5r!N)r)r*r+rZ�ZeroDivisionError�exceptionForTestsr�r�r�r�r�r�r,r!rr�r��s8���*�*N�O��.�.�"-�
�
�:�	6r!r�c��eZdZdZd�Zy)�FailureHoldingErrorHolderTestsz�
    Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder}
    when constructed with a L{Failure} representing its error.
    c��d|_	|j�#t$rtj�|_YnwxYwt
j|j|j
�|_|j�|_
yr})r�r�r�r
rkrLr�ErrorHolderrr�r�rs rrz$FailureHoldingErrorHolderTests.setUpDsf��(���	+��(�(�(�� �	+� ���*�D�J�	+���(�(��)9�)9�4�:�:�F����)�)�+��s��":�:Nr�r,r!rr�r�>s���
,r!r�c��eZdZdZd�Zy)�ExcInfoHoldingErrorHolderTestsz�
    Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder}
    when constructed with a C{exc_info}-style tuple representing its error.
    c��d|_	|j�#t$r0tj�}tj�|_YnwxYwtj|j|�|_
|j�|_yr})
r�r�r��sys�exc_infor
rkrLrr�rr�r�)r�
exceptionInfos  rrz$ExcInfoHoldingErrorHolderTests.setUpUso��(���	+��(�(�(�� �	+��L�L�N�M� ���*�D�J�	+���(�(��)9�)9�=�I����)�)�+��s��6A�
ANr�r,r!rr�r�Os���
	,r!r�c�R�eZdZdZGd�dej
�Zd�Zd�Zd�Z	d�Z
y)	�MalformedMethodTestszR
    Test that trial manages when test methods don't have correct signatures.
    c�@�eZdZdZd�Zd�Zeje�Zy)�%MalformedMethodTests.ContainMalformedzV
        This TestCase holds malformed test methods that trial should handle.
        c��yrr,)r�blahs  rr�z.MalformedMethodTests.ContainMalformed.test_fookr�r!c��yrr,r,r!r�test_barz.MalformedMethodTests.ContainMalformed.test_barnr�r!N)	r)r*r+rZr�r�r�inlineCallbacks�	test_spamr,r!r�ContainMalformedr�fs%��	�	�	�*�E�)�)�(�3�	r!r�c�n�t�}tjtj|��}t
j
|�}|j|�}|j|jd�|j|j��|jt|j�d�y)zL
        Wrapper for one of the test method of L{ContainMalformed}.
        r|r$N)rrr~rrLr�r�rgrhr\rOrYrfr)rr<r5�trialRunnerrFr�s      r�_testzMalformedMethodTests._testss�������(�(��):�):�6�J��#�4�4�V�<������&��������!�,�����-�-�/�0�����V�]�]�+�Q�/r!c�&�|jd�y)zE
        Test when the method has extra (useless) arguments.
        r�N�r�rs r�
test_extraArgz"MalformedMethodTests.test_extraArg���	
�
�
�:�r!c�&�|jd�y)zJ
        Test when the method doesn't have even self as argument.
        r�Nr�rs r�
test_noArgzMalformedMethodTests.test_noArg�r�r!c�&�|jd�y)z5
        Test a decorated method also fails.
        r�Nr�rs r�test_decoratedz#MalformedMethodTests.test_decorated�s��	
�
�
�;�r!N)r)r*r+rZr�r�r�r�r�r�r�r,r!rr�r�as+���4�6�?�?�4�
0��� r!r�c�"�eZdZdZd�Zd�Zd�Zy)�DestructiveTestSuiteTestsz2
    Test for L{runner.DestructiveTestSuite}.
    c�P��g�G�fd�dtj�}|d�}tj�}t	j
|g�}|j
�g�|j|�|j
�dg�|j
|j�d�y)zL
        Thes destructive test suite should run the tests normally.
        c���eZdZ�fd�Zy)�6DestructiveTestSuiteTests.test_basic.<locals>.MockTestc�(���jd�yr)rU�rF�calleds �rr�z?DestructiveTestSuiteTests.test_basic.<locals>.MockTest.test_foo�s����
�
�d�#r!Nr��r�s�rr�r��s���
$r!r�r�TrN)	r�r�rrur�DestructiveTestSuiterhrgrr)rr�rFr�r�r�s     @r�
test_basicz$DestructiveTestSuiteTests.test_basic�s������	$�v���	$��
�#���$�$�&���+�+�T�F�3�������$�
�	�	�&������$��(�����-�-�/��3r!c���g�G�fd�dtj�}tj�}t	j
�}tj|_|j|�}|j�g�|j|�|j�dg�|j|j�d�y)zu
        Test the C{shouldStop} management: raising a C{KeyboardInterrupt} must
        interrupt the suite.
        c�(��eZdZ�fd�Zd�Z�fd�Zy)�;DestructiveTestSuiteTests.test_shouldStop.<locals>.MockTestc�(���jd�y)Nr$rUr�s �r�	test_foo1zEDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo1������
�
�a� r!c��t��r)�KeyboardInterrupt�rFs r�	test_foo2zEDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo2�s��'�)�)r!c�(���jd�y)NrmrUr�s �r�	test_foo3zEDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo3�r�r!N)r)r*r+r�r�r�r�s�rr�r��s���
!�
*�
!r!r�r$N)rr�rrurrr��suiteFactory�	loadClassrhrgrr)rr�r�rr�r�s     @r�test_shouldStopz)DestructiveTestSuiteTests.test_shouldStop�s����
��	!�x�(�(�	!��$�$�&���"�"�$��$�9�9���� � ��*�������$�
�	�	�&������!��%�����-�-�/��3r!c�<�Gd�dtj�}|d�}tj�}t	j
|g�}|j
|j�d�|j|�|j
|j�d�y)zn
        Checks that the test suite cleanups its tests during the run, so that
        it ends empty.
        c��eZdZd�Zy)�8DestructiveTestSuiteTests.test_cleanup.<locals>.MockTestc��yrr,r�s rr�zADestructiveTestSuiteTests.test_cleanup.<locals>.MockTest.test_foo�r�r!Nr�r,r!rr�r��r�r!r�r�r$rN)	r�r�rrurr�rhrrrg)rr�rFr�r�s     r�test_cleanupz&DestructiveTestSuiteTests.test_cleanup�s|��	�v���	��
�#���$�$�&���+�+�T�F�3������-�-�/��3�
�	�	�&������-�-�/��3r!N)r)r*r+rZr�r�r�r,r!rr�r��s���4�$4�64r!r�c�6�eZdZGd�dej�Zy)�RunnerDeprecationTestsc�4�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
y)�#RunnerDeprecationTests.FakeReporterz�
        Fake reporter that does *not* implement done() but *does* implement
        printErrors, separator, printSummary, stream, write and writeln
        without deprecations.
        Nc��yrr,r�s  r�printErrorsz/RunnerDeprecationTests.FakeReporter.printErrors�r�r!c��yrr,r�s  r�printSummaryz0RunnerDeprecationTests.FakeReporter.printSummary�r�r!c��yrr,r�s  r�writez)RunnerDeprecationTests.FakeReporter.write�r�r!c��yrr,r�s  r�writelnz+RunnerDeprecationTests.FakeReporter.writeln�r�r!)r)r*r+rZrHr[r5r�r�r�r�r,r!r�FakeReporterr��s,��	����	���	�	�	�	r!r�N)r)r*r+rrLr�r,r!rr�r��s���x�(�(�r!r�c��eZdZdZd�Zy)�QualifiedNameWalkerTestsz<
    Tests for L{twisted.trial.runner._qualNameWalker}.
    c�|�ttjd��}|j|dgfddgfdddgfg�y)z�
        C{_qualNameWalker} is a generator that, when given a Python qualified
        name, yields that name, and then the parent of that name, and so forth,
        along with a list of the tried components, in a 2-tuple.
        zwalker.texas.rangerzwalker.texas�ranger�walker�texasN)r�r�_qualNameWalkerrh)r�
walkerResultss  r�test_walksDownPathz+QualifiedNameWalkerTests.test_walksDownPath�sO���V�3�3�4I�J�K�
�����&��+��(��,��G�X�.�/�
�	
r!N)r)r*r+rZr�r,r!rr�r��s���
r!r�c��eZdZdZd�Zy)�TrialMainDoesNothingTestszl
    Importing L{twisted.trial.__main__} will not run the script
    unless it is actually C{__main__}.
    c��td�y)zO
        If we import L{twisted.trial.__main__}, it should do nothing.
        ztwisted.trial.__main__N)�
__import__rs r�test_importDoesNothingz0TrialMainDoesNothingTests.test_importDoesNothings
��
	�+�,r!N)r)r*r+rZr�r,r!rr�r�s���
-r!r�)@r�r-r�rr��ior�typingr�zope.interfacer�zope.interface.verifyr�twistedr�twisted.internetr�twisted.pluginsr	�twisted.pythonr
rr�twisted.python.filepathr
�twisted.python.reflectr�twisted.scriptsr�
twisted.trialrrr�twisted.trial._asyncrunnerr�twisted.trial.itrialrrrr.r^r�rzr�r�r�r�r�r�r?rCrbr�rgrmr{r�r�r�r�r�r�r�r�r,r!r�<module>r
s���
�
�
����&�.��"�)�0�0�,�+�!�:�:�G�5�%�%�
�Y��N�N��N�b#�#�L5�,�h�.J�.J�5�(
3��8�7�7�
3� )'�)'�X(�[�(�*F�*F�(�(�+�x�;�;�(�(��X�%A�%A�(�_=�(�.�.�_=�D	4�h�2�2�4�I
��4�4�I
�X6�0�6�(	'�F�$�$�	'�A��4�4�A�>!-�h�2�2�!-�HK6�K6�\,�%:�O�,�",�%:�O�,�$. �8�7�7�. �bA4�� <� <�A4�H�X�9�9��2
�x�;�;�
�.-�� <� <�-r!

Zerion Mini Shell 1.0