%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����J�ddlmZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZddlm Z ddl!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(ddl)m*Z*ddl+m,Z,e-d�Z.d1d�Z/d2d�Z0d3d�Z1d4d�Z2e"e2e1�Z3Gd�dejh�Z5Gd�dejh�Z6Gd�dejh�Z7Gd�d ejh�Z8Gd!�d"ejh�Z9Gd#�d$ejh�Z:Gd%�d&ejv�Z<Gd'�d(ejv�Z=Gd)�d*ejv�Z>Gd+�d,ejv�Z?Gd-�d.ejv�Z@Gd/�d0ejv�ZAy)5�)�annotationsN)�StringIO)�List)�assert_that�contains_string)�given)�sampled_from)�Logger)�util)�FilePath�	IFilePath)�
UsageError)�trial)�unittest)�DistTrialRunner)�compose)�DestructiveTestSuite�
TestLoader�	TestSuite�TrialRunner�_Runner)�	testNames�)�fileContentsrc�6�tjt|�S)z1
    For finding files in twisted/trial/test
    )r�sibpath�__file__)�filenames �@/usr/lib/python3/dist-packages/twisted/trial/test/test_script.pyrr&s���<�<��(�+�+�c�6�t�jd�y)z.
    Emit something to L{twisted.logger}.
    �	somethingN)r
�info�r r�logSomethingr%-s���H�M�M�+�r c�P�tj�}|j|�|S)z?
    Parse an argument list using trial's argument parser.
    )r�Options�parseOptions)�argv�configs  r�parseArgumentsr+4s"���]�]�_�F�
������Mr c��tj|�}t�|_t	t
j
t�g�}|j|�|S)zM
    Run L{logSomething} as a test method using the given configuration.
    )	r�_makeRunnerr�streamr�pyunit�FunctionTestCaser%�run)r*�runner�suites   r�
runFromConfigr4=sF���
�
�v�
&�F��J�F�M��v�.�.�|�<�=�>�E�
�J�J�u���Mr c��eZdZdZeegd���d	d��Zeeddg��d
d��Zeeddg��d
d��Zy)�LogfileTestsz)
    Tests for the --logfile option.
    )zdir-azdir-bzdir-c/dir-dc��td|g�}t|�j|d�}t|t	td���y)z�
        If no value is given for the option then logs are written to a log
        file constructed from a default value.
        �--temp-directory�logfiler"N��runFromArgumentsr�preauthChildrrr)�self�workingDirectoryr*�logPaths    r�test_defaultzLogfileTests.test_defaultPsD��"�#5�7G�"H�I��%�&6�7�D�D�V�I�EV�W���G�\�/�+�*F�G�Hr zsomelog.txtzsomedir/somelog.txtc��td|g�}t|d�j|�}t|t	td���y)z�
        If the value given for the option is a relative path then it is
        interpreted relative to trial's own temporary working directory and
        logs are written there.
        �	--logfile�temp-directoryr"Nr:)r=r9r*r?s    r�test_relativePathzLogfileTests.test_relativePathbsB��"�;��"8�9��%�f�-=�&>�?�L�L�W�U���G�\�/�+�*F�G�Hr c��td�j|�}td|jg�|}t	|tt
d���y)z�
        If the value given for the option is an absolute path then it is
        interpreted absolutely and logs are written there.
        �.rBr"N)rr<r;�pathrrr)r=r9r?�iPaths    r�test_absolutePathzLogfileTests.test_absolutePathtsB��"�3�-�,�,�W�5���+�w�|�|�4�5�"���E�<���(D�E�Fr N)r>�str�return�None)r9rJrKrL)	�__name__�
__module__�__qualname__�__doc__rr	r@rDrIr$r rr6r6Ks������
�	
��I��I����%�
�	
��I��I����%�
�	
��G��Gr r6c�@�eZdZdZd	d�Zd	d�Zd	d�Zd
d�Zd	d�Zd	d�Z	y)�ForceGarbageCollectionTestsz*
    Tests for the --force-gc option.
    c���tj�|_g|_|j	t
d|j�tj|j�}t||g�|_y)N�collect)rr'r*�log�patch�gcrTr/r0�
simpleTestr�test)r=rYs  r�setUpz!ForceGarbageCollectionTests.setUp�sN���m�m�o��� ����
�
�2�y�$�,�,�/��&�&�t���7���t�T�l�+��	r c�:�|jjd�y)zD
        A simple test method that records that it was run.
        rYN�rU�append�r=s rrXz&ForceGarbageCollectionTests.simpleTest�s��	
������r c�:�|jjd�y)zI
        A replacement for gc.collect that logs calls to itself.
        rTNr\r^s rrTz#ForceGarbageCollectionTests.collect�s��	
�����	�"r c�b�tj|j�}t�|_|S)zN
        Return a L{TrialRunner} object that is safe to use in tests.
        )rr-r*rr.�r=r2s  r�
makeRunnerz&ForceGarbageCollectionTests.makeRunner�s&���"�"�4�;�;�/�� �
��
��
r c���d|jd<|jj�|j�}|j|j�|j|jgd��y)z�
        Passing the --force-gc option to the trial script forces the garbage
        collector to run before and after each test.
        Tzforce-gc)rTrYrTrTrYrTN�r*�postOptionsrbr1rY�assertEqualrUras  r�test_forceGcz(ForceGarbageCollectionTests.test_forceGc�sV��
#'����J�������!����"���
�
�4�9�9������H�H�R�	
r c���|jj�|j�}|j|j�|j|jddg�y)z>
        By default, no garbage collection is forced.
        rYNrdras  r�test_unforceGcz*ForceGarbageCollectionTests.test_unforceGc�sI��	
�����!����"���
�
�4�9�9��������F�F�#3�4r N�rKrL)rKr)
rMrNrOrPrZrXrTrbrgrir$r rrRrR�s%���,� �#��
�5r rRc�(�eZdZdZdd�Zdd�Zdd�Zy)�SuiteUsedTestsz?
    Check the category of tests suite used by the loader.
    c�6�tj�|_y)z6
        Create a trial configuration object.
        N�rr'r*r^s rrZzSuiteUsedTests.setUp�s���m�m�o��r c��tj|j�}|j|jt
�y)zK
        By default, the loader should use L{DestructiveTestSuite}
        N)r�
_getLoaderr*rf�suiteFactoryr�r=�loaders  r�test_defaultSuitez SuiteUsedTests.test_defaultSuite�s/���!�!�$�+�+�.������,�,�.B�Cr c��d|jd<tj|j�}|j|jt
�y)zw
        The C{until-failure} configuration uses the L{TestSuite} to keep
        instances alive across runs.
        Tz
until-failureN)r*rrprfrqrrrs  r�test_untilFailureSuitez%SuiteUsedTests.test_untilFailureSuite�s<��
(,����O�$��!�!�$�+�+�.������,�,�i�8r Nrj)rMrNrOrPrZrtrvr$r rrlrl�s���&�D�9r rlc���eZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�TestModuleTestsc�6�tj�|_y�Nrnr^s rrZzTestModuleTests.setUp�����m�m�o��r c��d|_yrz)r*r^s r�tearDownzTestModuleTests.tearDown�s	����r c�X�|jt|�|j�g�y)zq
        Check that the testNames helper method accurately collects the
        names of tests in suite.
        N)rfr�idr^s r�test_testNameszTestModuleTests.test_testNames�s ��
	
����4��4�7�7�9�+�6r c���t�}t|�}ttt|j|���}|j�|j�|j
||�yrz)rrr�map�
loadByName�sortrf)r=�test1�namesrs�names1�names2s      r�assertSuitesEqualz!TestModuleTests.assertSuitesEqual�sQ������5�!���9�S��):�):�E�%B�C�D�����
����
������(r c�T�|jdt|jd��y)Nr�tests)rf�lenr*r^s r�test_baseStatezTestModuleTests.test_baseState�s ������C����G� 4�5�6r c��|jjtd��|jt	j
|j�dg�y)z�
        Check that --testmodule loads a suite which contains the tests
        referred to in test-case-name inside its parameter.
        �
moduletest.py�twisted.trial.test.test_logN�r*�opt_testmodulerr�r�	_getSuiter^s r�test_testmoduleOnModulez'TestModuleTests.test_testmoduleOnModule�s?��
	
���"�"�7�?�#;�<�����O�O�D�K�K�(�+H�*I�	
r c���|jjtd��|jjtd��|jt	j
|j�dg�y)z�
        When the same module is specified with two --testmodule flags, it
        should only appear once in the suite.
        r�r�Nr�r^s r�test_testmoduleTwicez$TestModuleTests.test_testmoduleTwicesV��
	
���"�"�7�?�#;�<����"�"�7�?�#;�<�����O�O�D�K�K�(�+H�*I�	
r c���|jjtd��|jjtd��|jt	j
|j�dg�y)z�
        If --testmodule is specified twice, once for module A and once for
        a module which refers to module A, then make sure module A is only
        added once.
        r�ztest_log.pyr�Nr�r^s r� test_testmoduleOnSourceAndTargetz0TestModuleTests.test_testmoduleOnSourceAndTargetsV��	
���"�"�7�?�#;�<����"�"�7�=�#9�:�����O�O�D�K�K�(�+H�*I�	
r c��|jjtd��|jt	j
|j�dg�y)z�
        When given a module that refers to *itself* in the test-case-name
        variable, check that --testmodule only adds the tests once.
        z
moduleself.pyztwisted.trial.test.moduleselfNr�r^s r�test_testmoduleOnSelfModulez+TestModuleTests.test_testmoduleOnSelfModules?��
	
���"�"�7�?�#;�<�����O�O�D�K�K�(�+J�*K�	
r c��|jjtd��|jt	j
|j�ddg�y)zm
        Check that --testmodule loads tests referred to in test-case-name
        buffer variables.
        �
scripttest.pyr��twisted.trial.test.test_runnerNr�r^s r�test_testmoduleOnScriptz'TestModuleTests.test_testmoduleOnScript"sB��
	
���"�"�7�?�#;�<�����O�O�D�K�K�(�
*�,L�M�	
r c�Z�t�}tj|c}t_d}	|jj	|�|jdt
|jd��|jd|�d�|j��|t_y#|t_wxYw)zz
        Check that --testmodule displays a meaningful error message when
        passed a non-existent filename.
        ztest_thisbetternoteverexist.pyrr��File � doesn't exist
N�r�sys�stderrr*r�rfr��getvalue)r=�buffyr�rs    r� test_testmoduleOnNonexistentFilez0TestModuleTests.test_testmoduleOnNonexistentFile-s���
�
�� �Z�Z�����
�3��	 ��K�K�&�&�x�0����Q��D�K�K��$8� 9�:����u�X�L�0@�A�5�>�>�CS�T��C�J���C�J���A'B�
B*c��|jjtd��|jdt	|jd��y)z�
        Check that --testmodule adds no tests to the suite for modules
        which lack test-case-name buffer variables.
        �	novars.pyrr�N)r*r�rrfr�r^s r�test_testmoduleOnEmptyVarsz*TestModuleTests.test_testmoduleOnEmptyVars<s9��
	
���"�"�7�;�#7�8�����C����G� 4�5�6r c�Z�t�}tj|c}t_d}	|jj	|�|jdt
|jd��|jd|�d�|j��|t_y#|t_wxYw)z�
        Check that --testmodule does *not* support module names as arguments
        and that it displays a meaningful error message.
        ztwisted.trial.test.test_scriptrr�r�r�Nr�)r=r�r��
moduleNames    r�test_testmoduleOnModuleNamez+TestModuleTests.test_testmoduleOnModuleNameDs���
�
�� �Z�Z�����
�5�
�	 ��K�K�&�&�z�2����Q��D�K�K��$8� 9�:����u�Z�N�2B�C�U�^�^�EU�V��C�J���C�J�r�c�Z�d}tj|�}|jddi|�y)Nz5-*- test-case-name: twisted.trial.test.test_tests -*-�test-case-name�twisted.trial.test.test_tests�r�_parseLocalVariablesrf�r=�declaration�	localVarss   r�test_parseLocalVariablez'TestModuleTests.test_parseLocalVariableSs.��M���.�.�{�;�	����*�,K�L�i�Xr c�Z�d}tj|�}|jddi|�y)Nz6-*- test-case-name: twisted.trial.test.test_tests; -*-r�r�r�r�s   r�test_trailingSemicolonz&TestModuleTests.test_trailingSemicolonXs.��N���.�.�{�;�	����*�,K�L�i�Xr c�\�d}tj|�}|jddd�|�y)Nz?-*- test-case-name: twisted.trial.test.test_tests; foo: bar -*-r��bar)r��foor�r�s   r�test_parseLocalVariablesz(TestModuleTests.test_parseLocalVariables]s4��P�	��.�.�{�;�	����>�u�M�y�	
r c�Z�d}tj|�}|jddi|�y)Nz:## -*- test-case-name: twisted.trial.test.test_tests -*- #r�r�r�r�s   r�test_surroundingGuffz$TestModuleTests.test_surroundingGufffs.��U���.�.�{�;�	����*�,K�L�i�Xr c�N�|jttjd�y�Nr���assertRaises�
ValueErrorrr�r^s r�test_invalidLinez TestModuleTests.test_invalidLineks�����*�e�&@�&@�%�Hr c���|jttjd�|jttjd�|jttjd�y)Nz-*- foo -*-z-*- foo: bar; qux -*-z-*- foo: bar: baz; qux: qax -*-r�r^s r�test_invalidDeclarationz'TestModuleTests.test_invalidDeclarationnsT�����*�e�&@�&@�-�P������2�2�4K�	
�	
�����2�2�4U�	
r c�h�tjtd��}|jddi|�y)Nr�r�r��r�loadLocalVariablesrrf�r=r�s  r�test_variablesFromFilez&TestModuleTests.test_variablesFromFilews.���,�,�W�_�-E�F�	����*�,I�J�I�Vr c�d�tjtd��}|ji|�y)Nr�r�r�s  r�test_noVariablesInFilez&TestModuleTests.test_noVariablesInFile{s'���,�,�W�[�-A�B�	�����Y�'r c�h�tjtd��}|jddi|�y)Nr�r�z:twisted.trial.test.test_log,twisted.trial.test.test_runnerr�r�s  r�test_variablesFromScriptz(TestModuleTests.test_variablesFromScripts5���,�,�W�_�-E�F�	���� �S�
�

�
	
r c�f�tjtd��}|j|dg�y)Nr�r�)r�getTestModulesrrf�r=�moduless  r�test_getTestModulesz#TestModuleTests.test_getTestModules�s+���&�&�w��'?�@������#@�"A�Br c�v�tjtd��}|jt	|�d�y)Nr�r)rr�rrfr�r�s  r�test_getTestModules_noVarsz*TestModuleTests.test_getTestModules_noVars�s+���&�&�w�{�';�<������W��q�)r c�z�tjtd��}|jt	|�ddh�y)Nr�r�r�)rr�rrf�setr�s  r�test_getTestModules_multiplez,TestModuleTests.test_getTestModules_multiple�s5���&�&�w��'?�@�������L�
*�,L�M�	
r c���dD]*}|jtj|�|�d���,dtd�td�fD]*}|j	tj|�|�d���,y)N)ztest_script.pyz!twisted/trial/test/test_script.pyz should be a test filez twisted/trial/test/moduletest.pyr�ztest_foo.batz should *not* be a test file)�
assertTruer�
isTestFiler�assertFalse)r=rs  r�test_looksLikeTestModulez(TestModuleTests.test_looksLikeTestModule�s���O�	�H��O�O�� � ��*��,�4�5�
�	�
/��O�$��N�#�
�	�H�

���� � ��*��,�:�;�
�	r Nrj)r�rr�z	list[str]rKrL)rMrNrOrZr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r$r rrxrx�s���&��7�)�7�
�	
�

�
�	
�
 �7�
 �Y�
Y�

�Y�
I�
�W�(�	
�C�*�
�r rxc�H�eZdZdZd
d�Zd
d�Zdd�Zdd�Zd
d�Zd
d�Z	d
d�Z
y	)�WithoutModuleTestsz*
    Test the C{without-module} flag.
    c�r�tj�|_ttj
�|_y)zl
        Create a L{trial.Options} object to be used in the tests, and save
        C{sys.modules}.
        N)rr'r*�dictr�r��savedModulesr^s rrZzWithoutModuleTests.setUp�s"��
�m�m�o��� ����-��r c��dD]Q}||jvr!|j|tj|<�2tjj|d��Sy)z)
        Restore C{sys.modules}.
        )�imaplib�smtplibN)r�r�r��pop)r=�modules  rr}zWithoutModuleTests.tearDown�sL��-�	.�F���*�*�*�&*�&7�&7��&?����F�#��������-�		.r c��ddl}|S)zE
        Try to import the C{smtplib} module, and return it.
        rN)r�)r=r�s  r�
_checkSMTPzWithoutModuleTests._checkSMTP����	��r c��ddl}|S)zE
        Try to import the C{imaplib} module, and return it.
        rN)r�)r=r�s  r�
_checkIMAPzWithoutModuleTests._checkIMAP�r�r c��|jjddg�|jt|j�t
jd=|j|j	�tj�y)zT
        Check that after disabling a module, it can't be imported anymore.
        �--without-moduler�N)
r*r(r��ImportErrorr�r�r��assertIsInstance�types�
ModuleTyper^s r�test_disableOneModulez(WithoutModuleTests.test_disableOneModule�sY��	
��� � �"4�i�!@�A����+�t���7��K�K�	�"����d�o�o�/��1A�1A�Br c��|jjddg�|jt|j�|jt|j
�tjd=tjd=|j|j	�tj�|j|j�tj�y)zE
        Check that several modules can be disabled at once.
        r�zsmtplib,imaplibr�r�N)r*r(r�r�r�r�r�r�r�r�r�r^s r�test_disableMultipleModulesz.WithoutModuleTests.test_disableMultipleModules�s���	
��� � �"4�6G�!H�I����+�t���7����+�t���7��K�K�	�"��K�K�	�"����d�o�o�/��1A�1A�B����d�o�o�/��1A�1A�Br c��|j|j�tj�|j	t
dtj|jjddg�|jt|j�y)zP
        Disabling an already imported module should produce a warning.
        z4Module 'smtplib' already imported, disabling anyway.r�r�N)r�r�r�r��assertWarns�RuntimeWarningrrr*r(r�r�r^s r�!test_disableAlreadyImportedModulez4WithoutModuleTests.test_disableAlreadyImportedModule�sg��	
���d�o�o�/��1A�1A�B�����B��N�N��K�K�$�$�
��+�	
�	
���+�t���7r Nrj)rK�object)rMrNrOrPrZr}r�r�r�r�r�r$r rr�r��s,���.�.���	C�C�8r r�c�H�eZdZdZeedd��dZd	d�Zd	d�Zd	d�Z	d	d�Z
y)
�
CoverageTestsz+
    Tests for the I{coverage} option.
    �gettraceNz;Cannot test trace hook installation without inspection API.c�h�|jtjtj��y)zf
        Arrange for the current trace hook to be restored when the
        test is complete.
        N)�
addCleanupr��settracer�r^s rrZzCoverageTests.setUps��
	
������c�l�l�n�5r c���tj�}|jdg�|j�J�|j	tj�|jj�y)z}
        L{trial.Options} handles C{"--coverage"} by installing a trace
        hook to record coverage information.
        z
--coverageN)rr'r(�tracerrfr�r��globaltrace�r=�optionss  r�test_tracerInstalledz"CoverageTests.test_tracerInstalledsS��
�-�-�/�����l�^�,��~�~�)�)�)�����L�L�N��N�N�&�&�	
r c��tj�}|j|j�t	d�j|ddg��y)z�
        L{trial.Options.coverdir} returns a L{FilePath} based on the default
        for the I{temp-directory} option if that option is not specified.
        rFrC�coverageN)rr'rf�coverdirr�
descendantrs  r�test_coverdirDefaultz"CoverageTests.test_coverdirDefaultsF��
�-�-�/����������S�M�$�$�g�.>�&?��%L�M�	
r c���|j�}tj�}|jd|g�|j	|j�t
|�jd��y)z�
        If a value is specified for the I{temp-directory} option,
        L{trial.Options.coverdir} returns a child of that path.
        r8r
N)�mktemprr'r(rfrr�child)r=rGrs   r�test_coverdirOverriddenz%CoverageTests.test_coverdirOverridden!sV��
�{�{�}���-�-�/�����0�$�7�8�����)�)�+�X�d�^�-A�-A�*�-M�Nr rj)rMrNrOrP�getattrr��skiprZrr
rr$r rr�r��s2����s�J��%�-�L��6�
�	
�Or r�c�@�eZdZdZd	d�Zd	d�Zd	d�Zd	d�Zd	d�Zd	d�Z	y)
�OptionsTestsz%
    Tests for L{trial.Options}.
    c�6�tj�|_y)zE
        Build an L{Options} object to be used in the tests.
        N�rr'rr^s rrZzOptionsTests.setUp1s���}�}���r c��|jtjtj��t	j
�r|jtj�|jjgd��|jj�}|jd|�|jd�|jddg|�y)z�
        C{_getWorkerArguments} discards options like C{random} as they only
        matter in the manager, and forwards options like C{recursionlimit} or
        C{disablegc}.
        )�--recursionlimit�2000�--random�4�--disablegcrrrN)
rr��setrecursionlimit�getrecursionlimitrW�	isenabled�enablerr(�_getWorkerArguments�assertIn�removerf)r=�argss  r�test_getWorkerArgumentsz$OptionsTests.test_getWorkerArguments7s���	
����-�-�s�/D�/D�/F�G�
�<�<�>��O�O�B�I�I�&����!�!�H�	
��|�|�/�/�1���
�
�m�T�*����M�"����,�f�5�t�<r c��|jt|jjgd��}|j	dt|��y)z�
        C{parseOptions} raises a C{UsageError} when C{--debug} is passed along
        C{--jobs} as it's not supported yet.

        @see: U{http://twistedmatrix.com/trac/ticket/5825}
        )�--jobsr�--debugz+You can't specify --debug when using --jobsN�r�rrr(rfrJ�r=�errors  r�test_jobsConflictWithDebugz'OptionsTests.test_jobsConflictWithDebugIs=���!�!�����1�1�3M�
��	
���F��E�
�Sr c��|jt|jjgd��}|j	dt|��y)z�
        C{parseOptions} raises a C{UsageError} when C{--profile} is passed
        along C{--jobs} as it's not supported yet.

        @see: U{http://twistedmatrix.com/trac/ticket/5827}
        )r(rz	--profilez-You can't specify --profile when using --jobsNr*r+s  r�test_jobsConflictWithProfilez)OptionsTests.test_jobsConflictWithProfileUs=���!�!�����1�1�3O�
��	
���H�#�e�*�Ur c��|jt|jjgd��}|j	dt|��y)z�
        C{parseOptions} raises a C{UsageError} when C{--debug-stacktraces} is
        passed along C{--jobs} as it's not supported yet.

        @see: U{http://twistedmatrix.com/trac/ticket/5826}
        )r(rz--debug-stacktracesz7You can't specify --debug-stacktraces when using --jobsNr*r+s  r�%test_jobsConflictWithDebugStackTracesz2OptionsTests.test_jobsConflictWithDebugStackTracesas@���!�!���L�L�%�%�2�
��
	
���E�s�5�z�	
r c��|jt|jjgd��}|j	dt|��y)zr
        C{parseOptions} raises a C{UsageError} when C{--order} is passed along
        with C{--random}.
        )�--order�alphabeticalr�1234z-You can't specify --random when using --orderNr*r+s  r�test_orderConflictWithRandomz)OptionsTests.test_orderConflictWithRandomqs>��
�!�!���L�L�%�%�;�
��
	
���H�#�e�*�Ur Nrj)
rMrNrOrPrZr&r-r/r1r6r$r rrr,s(���'�=�$
T�
V�
� 
Vr rc�8�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zy)	�MakeRunnerTestsz.
    Tests for the L{_makeRunner} helper.
    c�6�tj�|_yrzrr^s rrZzMakeRunnerTests.setUp�s���}�}���r c�>�|jjgd��tj|j�}t	|t
�sJ�|j
|t
�|jd|j�|jdg|j�y)z�
        L{_makeRunner} returns a L{DistTrialRunner} instance when the C{--jobs}
        option is passed.  The L{DistTrialRunner} knows how many workers to
        run and the C{workerArguments} to pass to them.
        )r(r�
--force-gc�r;N)
rr(rr-�
isinstancerr�rf�_maxWorkers�_workerArgumentsras  r�	test_jobszMakeRunnerTests.test_jobs�sy��	
���!�!�"?�@��"�"�4�<�<�0���&�/�2�2�2����f�o�6�����F�.�.�/����,���)@�)@�Ar c� �|jjgd��tj|j�}t	|t
�sJ�|j
|t
�|jt
j|j�y)z�
        L{_makeRunner} returns a L{TrialRunner} instance in C{DRY_RUN} mode
        when the C{--dry-run} option is passed, even if C{--jobs} is set.
        )r(rz	--dry-runN)
rr(rr-r=rr�rf�DRY_RUN�moderas  r�test_dryRunWithJobsz#MakeRunnerTests.test_dryRunWithJobs�se��
	
���!�!�">�?��"�"�4�<�<�0���&�+�.�.�.����f�k�2�����,�,�f�k�k�:r c�4��tjj�d�fd�}|jtjd|�tj�}|jgd��|j
tjtj|�y)Nc�\��|dk(rtjj|���|�S)N�	doNotFind)r�reflect�ModuleNotFound)�fqn�namedAnys �r�namedAnyExceptdoNotFindzFMakeRunnerTests.test_DebuggerNotFound.<locals>.namedAnyExceptdoNotFind�s*����k�!��m�m�2�2�3�7�7��C�=� r rK)r)z
--debuggerrG)rJrJrKr�)	rrHrKrVr'r(r��_DebuggerNotFoundr-)r=rLrrKs   @r�test_DebuggerNotFoundz%MakeRunnerTests.test_DebuggerNotFound�sf����=�=�)�)��	!�
	
�
�
�5�=�=�*�.E�F��-�-�/�����C�D����%�1�1�5�3D�3D�g�Nr c���|jjdg�tj|j�}t	|t
�sJ�|j
|j�y)z�
        Passing C{--exitfirst} wraps the reporter with a
        L{reporter._ExitWrapper} that stops on any non-success.
        z--exitfirstN)rr(rr-r=rr��
_exitFirstras  r�test_exitfirstzMakeRunnerTests.test_exitfirst�sN��
	
���!�!�=�/�2��"�"�4�<�<�0���&�+�.�.�.�����)�)�*r Nrj)	rMrNrOrPrZr@rDrNrQr$r rr8r8~s"���'�B�	;�
O�+r r8c� �eZdZdZdd�Zdd�Zy)�RunTestsz(
    Tests for the L{run} function.
    c�H�|jtjdd��y)Nr(c��yrzr$r^s r�<lambda>z RunTests.setUp.<locals>.<lambda>�s�r )rVrr'r^s rrZzRunTests.setUp�s��	
�
�
�5�=�=�.�2C�Dr c���dd�}|jtd|�	tj�|jd�y#t$r%}|jdt
|��Yd}~yd}~wwxYw)zY
        When a debugger is not found, an error message is printed to the user.

        c�,�tjd��r�)rrM)r%�kwargss  rr-z3RunTests.test_debuggerNotFound.<locals>._makeRunner�s���)�)�%�0�0r r-z0Should have exited due to non-existent debugger!r�N)r%r�rYr�rKrL)rVrr1�fail�
SystemExitr#rJ)r=r-�es   r�test_debuggerNotFoundzRunTests.test_debuggerNotFound�s^��	1�	
�
�
�5�-��5�	J��I�I�K�
�I�I�H�I���	)��M�M�%��Q��(�(��	)�s�A�	A1�A,�,A1Nrj)rMrNrOrPrZr]r$r rrSrS�s���E�
Jr rSc� �eZdZdZdd�Zdd�Zy)�TestArgumentOrderTestszQ
    Tests for the order-preserving behavior on provided command-line tests.
    c�T�tj�|_t�|_yrz)rr'r*rrsr^s rrZzTestArgumentOrderTests.setUp�s���m�m�o��� �l��r c�"�gd�}|jj|�tj|j�}t	|�}tt
|jj|��}t	|�}|j||�y)zN
        Multiple tests passed on the command line are not reordered.
        )r�z"twisted.trial.test.test_assertionsz twisted.trial.test.test_deferredN)
r*r(rr�rrr�rsr�rf)r=r�r3r��
expectedSuite�
expectedNamess      r�test_preserveArgumentOrderz1TestArgumentOrderTests.test_preserveArgumentOrder�sn��
��
	
��� � ��'�������,���%� ��!�#�d�k�k�&<�&<�e�"D�E�
�!�-�0�
�����
�.r Nrj)rMrNrOrPrZrdr$r rr_r_�s���#�/r r_c�X�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zy)
�
OrderTestsz'
    Tests for the --order option.
    c�6�tj�|_yrzrnr^s rrZzOrderTests.setUp�r{r c���|jjgd��tj|j�}|j	|jd�}|jt
|�gd��y)zn
        --order=alphabetical causes trial to run tests alphabetically within
        each test case.
        )r3r4�%twisted.trial.test.ordertests.FooTestr�)�0twisted.trial.test.ordertests.FooTest.test_first�1twisted.trial.test.ordertests.FooTest.test_fourth�1twisted.trial.test.ordertests.FooTest.test_second�0twisted.trial.test.ordertests.FooTest.test_thirdN�r*r(rrp�loadByNamesrfr�r=rsr3s   r�test_alphabeticalzOrderTests.test_alphabetical�sc��
	
��� � �P�	
��!�!�$�+�+�.���"�"�4�;�;�w�#7�8������e��
�	
r c���|jjgd��tj|j�}|j	|jd�}|jt
|�gd��y)zu
        --order=alphabetical causes trial to run test classes within a given
        module alphabetically.
        )r3r4�twisted.trial.test.ordertestsr�)�.twisted.trial.test.ordertests.BarTest.test_bar�.twisted.trial.test.ordertests.BazTest.test_bazrjrkrlrmNrnrps   r�test_alphabeticalModulez"OrderTests.test_alphabeticalModulesc��
	
��� � �H�	
��!�!�$�+�+�.���"�"�4�;�;�w�#7�8������e��
�
	
r c�*�|jjgd��tj|j�}|j	|jd�}t|�}|j
|d��|j|t|��y)z�
        --order=alphabetical causes trial to run test modules within a given
        package alphabetically, with tests within each module alphabetized.
        )r3r4�twisted.trial.testr�zFailed to load any tests!��msgN)	r*r(rrprorr�rf�sorted�r=rsr3r�s    r�test_alphabeticalPackagez#OrderTests.test_alphabeticalPackage'ss��
	
��� � �!R�S��!�!�$�+�+�.���"�"�4�;�;�w�#7�8���%� ������#>��?������u�
�.r c���|jjgd��tj|j�}|j	|jd�}|jt
|�gd��y)z�
        --order=toptobottom causes trial to run test methods within a given
        test case from top to bottom as they are defined in the body of the
        class.
        )r3�toptobottomrir�)rjrlrmrkNrnrps   r�test_toptobottomzOrderTests.test_toptobottom4sc��	
��� � �O�	
��!�!�$�+�+�.���"�"�4�;�;�w�#7�8������e��
�	
r c���|jjgd��tj|j�}|j	|jd�}|jt
|�gd��y)z�
        --order=toptobottom causes trial to run test classes within a given
        module from top to bottom as they are defined in the module's source.
        �r3rrsr�)rjrlrmrkrurtNrnrps   r�test_toptobottomModulez!OrderTests.test_toptobottomModuleKsc��
	
��� � �G�	
��!�!�$�+�+�.���"�"�4�;�;�w�#7�8������e��
�
	
r c�
�|jjgd��tj|j�}|j	|jd�}t|�}|j
|t|d����y)z�
        --order=toptobottom causes trial to run test modules within a given
        package alphabetically, with tests within each module run top to
        bottom.
        )r3rrxr�c�*�|jd�ddS)NrFr<)�split)�names rrVz4OrderTests.test_toptobottomPackage.<locals>.<lambda>qs��4�:�:�c�?�2�A�+>�r )�keyN)r*r(rrprorrfr{r|s    r�test_toptobottomPackagez"OrderTests.test_toptobottomPackagebsl��	
��� � �!Q�R��!�!�$�+�+�.���"�"�4�;�;�w�#7�8���%� ��	
�����5�>�?�	
r c���|j�}t|�jd�}|j�|jd�j	d�|jd�j	tjd�jd��|j�j}tjjd|�|jtjj|�ddlm}|jtj j"d�|jtj j"|j$�|jd�j�|j&j)gd	��t+j,|j&�}|j/|�}|j1t3|�gd
��y)z{
        --order=toptobottom detects the source line of methods from modules
        whose source file is missing.
        �twisted_toptobottom_tempz__init__.pyr ztest_missing.pya 
        from twisted.trial.unittest import TestCase
        class TestMissing(TestCase):
            def test_second(self) -> None: pass
            def test_third(self) -> None: pass
            def test_fourth(self) -> None: pass
            def test_first(self) -> None: pass
        �utf8r)�test_missingr�)z=twisted_toptobottom_temp.test_missing.TestMissing.test_secondz<twisted_toptobottom_temp.test_missing.TestMissing.test_thirdz=twisted_toptobottom_temp.test_missing.TestMissing.test_fourthz<twisted_toptobottom_temp.test_missing.TestMissing.test_firstN)rrr�makedirs�
setContent�textwrap�dedent�encode�parentrGr��insertrr$r�r�r�r�rMr*r(rrp�
loadModulerfr)r=�tempdir�package�	pathEntryr�rsr3s       r�test_toptobottomMissingSourcez(OrderTests.test_toptobottomMissingSourcets^��
�+�+�-���7�#�)�)�*D�E�������
�
�m�$�/�/��4��
�
�'�(�3�3��O�O��	
��f�V�n�	
��N�N�$�)�)�	�������9�%����������3�	
�	
��������)C�D����������)>�)>�?��
�
�'�(�/�/�1���� � �G�	
��!�!�$�+�+�.���!�!�,�/������e��
�	
r c�^�|jt|jjddg�y)zL
        An unknown order passed to --order raises a L{UsageError}.
        r3z
I don't existN)r�rr*r(r^s r�test_unknownOrderzOrderTests.test_unknownOrder�s(��
	
�������0�0�9�o�2N�	
r Nrj)
rMrNrOrPrZrqrvr}r�r�r�r�r�r$r rrfrf�s5���&�
�,
�./�
�.
�.
�$.
�`
r rfc��eZdZdZdd�Zy)�HelpOrderTestsz+
    Tests for the --help-orders flag.
    c��|jtdt�x}�|jttj�jdg�}|j|jd�|j�}d}t
jj�D]a\}\}}tjtj|��dtj|���|�}|j!||||fz���cy)zS
        --help-orders prints each of the available orders and then exits.
        �stdoutz
--help-ordersrz4%r with its description not properly described in %rz.*ryN)rVr�rr�r[rr'r(rf�coder��
_runOrders�items�re�search�escaper�)	r=r��exc�outputrz�	orderName�	orderDesc�_�matchs	         r�&test_help_ordersPrintsSynopsisAndQuitsz5HelpOrderTests.test_help_ordersPrintsSynopsisAndQuits�s���	
�
�
�3��H�J�"6�&�7������
�
��4�4��6G�
��	
������1�%����"��D��).�)9�)9�)?�)?�)A�	B�%�I�~�	�1��I�I��9�9�Y�'�(��2�9�9�Y�+?�*@�A���E�

�O�O�E�s�i��-@�'@�O�A�
	Br Nrj)rMrNrOrPr�r$r rr�r��s
���Br r�)rrJrKrJrj)r)z	List[str]rK�
trial.Options)r*r�rKr�)B�
__future__rrWr�r�r�r��ior�typingr�hamcrestrr�
hypothesisr�hypothesis.strategiesr	�twisted.loggerr
�twisted.pythonr�twisted.python.filepathrr
�twisted.python.usager�twisted.scriptsr�
twisted.trialr�twisted.trial._dist.disttrialr�twisted.trial._dist.functionalr�twisted.trial.runnerrrrrr�twisted.trial.test.test_loaderr�matchersr�
__import__r/rr%r+r4r;�SynchronousTestCaser6rRrlrxr�r��TestCaserr8rSr_rfr�r$r r�<module>r�sq��#�	�	�
�����1��.�!��7�+�!�"�9�2���5�"�	�J�	��,�����=�.�9��=G�8�/�/�=G�@45�(�">�">�45�n9�X�1�1�9�8I�h�2�2�I�XL8��5�5�L8�^0O�H�0�0�0O�fOV�8�$�$�OV�d7+�h�'�'�7+�tJ�x� � �J�:/�X�.�.�/�:y
��"�"�y
�xB�X�&�&�Br 

Zerion Mini Shell 1.0