ó
    ×›‘hÜ�  ã                  ó�  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	  S SK
Jr  S SKJr  S SKJrJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJrJr  S SKJr  S SKJr  S SK Jr  S SK!J"r"  S SK#J$r$  S SK%J&r&J'r'J(r(J)r)J*r*  S SK+J,r,  SSK-J.r.  \/" S5      r0S4S jr1S5S jr2S6S jr3S7S jr4\$" \4\35      r5 " S S\Rl                  5      r7 " S S\Rl                  5      r8 " S S\Rl                  5      r9 " S  S!\Rl                  5      r: " S" S#\Rl                  5      r; " S$ S%\Rl                  5      r< " S& S'\Rl                  5      r= " S( S)\R|                  5      r? " S* S+\R|                  5      r@ " S, S-\R|                  5      rA " S. S/\R|                  5      rB " S0 S1\R|                  5      rC " S2 S3\R|                  5      rDg)8é    )ÚannotationsN)ÚStringIO)ÚList)ÚskipIf)Úassert_thatÚcontains_string)Úgiven)Úsampled_from)ÚLogger)Úutil)ÚFilePathÚ	IFilePath)Ú
UsageError)Útrial)Úunittest)ÚDistTrialRunner)Úcompose)ÚDestructiveTestSuiteÚ
TestLoaderÚ	TestSuiteÚTrialRunnerÚ_Runner)Ú	testNamesé   )ÚfileContentsr   c                ó8   • [         R                  " [        U 5      $ )z)
For finding files in twisted/trial/test
)r   ÚsibpathÚ__file__)Úfilenames    ÚbC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/trial/test/test_script.pyr   r   (   s   € ô �<Š<œ (Ó+Ð+ó    c                 ó6   • [        5       R                  S5        g)z&
Emit something to L{twisted.logger}.
Ú	somethingN)r   Úinfo© r!   r    ÚlogSomethingr&   /   s   € ô ƒH‡M�M�+Õr!   c                óR   • [         R                  " 5       nUR                  U 5        U$ )z7
Parse an argument list using trial's argument parser.
)r   ÚOptionsÚparseOptions)ÚargvÚconfigs     r    ÚparseArgumentsr,   6   s"   € ô �]Š]‹_€FØ
×Ñ˜ÔØ€Mr!   c                ó¸   • [         R                  " U 5      n[        5       Ul        [	        [
        R                  [        5      /5      nUR                  U5        U $ )zE
Run L{logSomething} as a test method using the given configuration.
)	r   Ú_makeRunnerr   Ústreamr   ÚpyunitÚFunctionTestCaser&   Úrun)r+   ÚrunnerÚsuites      r    ÚrunFromConfigr5   ?   sF   € ô ×Ò˜vÓ&€FÜ“J€F„MÜ”v×.Ñ.¬|Ó<Ð=Ó>€EØ
‡J�JˆuÔØ€Mr!   c                  ó¨   • \ rS rSrSr\" \" / SQ5      5      SS j5       r\" \" SS/5      5      SS j5       r\" \" SS/5      5      SS j5       r	S	r
g
)ÚLogfileTestséM   z!
Tests for the --logfile option.
)zdir-azdir-bzdir-c/dir-dc                ó”   • [        SU/5      n[        U5      R                  US   5      n[        U[	        [        S5      5      5        g)zk
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   ÚpreauthChildr   r   r   )ÚselfÚworkingDirectoryr+   ÚlogPaths       r    Útest_defaultÚLogfileTests.test_defaultR   sD   € ô "Ð#5Ð7GÐ"HÓIˆÜ%Ð&6Ó7×DÑDÀVÈIÑEVÓWˆÜ�Gœ\¬/¸+Ó*FÓGÕHr!   zsomelog.txtzsomedir/somelog.txtc                ó”   • [        SU/5      n[        US   5      R                  U5      n[        U[	        [        S5      5      5        g)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?   r;   r+   rA   s       r    Útest_relativePathÚLogfileTests.test_relativePathd   sB   € ô " ;°Ð"8Ó9ˆÜ% fÐ-=Ñ&>Ó?×LÑLÈWÓUˆÜ�Gœ\¬/¸+Ó*FÓGÕHr!   c                ó¦   • [        S5      R                  U5      n[        SUR                  /5        Un[	        U[        [        S5      5      5        g)zu
If the value given for the option is an absolute path then it is
interpreted absolutely and logs are written there.
Ú.rE   r#   N)r   r>   r=   Úpathr   r   r   )r?   r;   rA   ÚiPaths       r    Útest_absolutePathÚLogfileTests.test_absolutePathv   sB   € ô" ˜3“-×,Ñ,¨WÓ5ˆÜ˜+ w§|¡|Ð4Ô5Ø"ˆÜ�Eœ<¬¸Ó(DÓEÕFr!   r%   N)r@   ÚstrÚreturnÚNone)r;   rO   rP   rQ   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r	   r
   rB   rG   rM   Ú__static_attributes__r%   r!   r    r7   r7   M   s‹   † ññ Ùòó	
óóIóðIñ ÙàØ%ðó	
óóIóðIñ ÙàØ%ðó	
óóGóóGr!   r7   c                  óT   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
S	rg
)ÚForceGarbageCollectionTestsé�   z"
Tests for the --force-gc option.
c                óè   • [         R                  " 5       U l        / U l        U R	                  [
        SU R                  5        [        R                  U R                  5      n[        X/5      U l        g )NÚcollect)r   r(   r+   ÚlogÚpatchÚgcr\   r0   r1   Ú
simpleTestr   Útest)r?   ra   s     r    ÚsetUpÚ!ForceGarbageCollectionTests.setUp’   sL   € Ü—m’m“oˆŒØ ˆŒØ�
‰
”2�y $§,¡,Ô/Ü×&Ñ& t§¡Ó7ˆÜ˜t˜lÓ+ˆ�	r!   c                ó:   • U R                   R                  S5        g)z4
A simple test method that records that it was run.
ra   N©r]   Úappend©r?   s    r    r`   Ú&ForceGarbageCollectionTests.simpleTest™   s   € ð 	�‰�‰˜Õr!   c                ó:   • U R                   R                  S5        g)z9
A replacement for gc.collect that logs calls to itself.
r\   Nre   rg   s    r    r\   Ú#ForceGarbageCollectionTests.collectŸ   s   € ð 	�‰�‰˜	Õ"r!   c                ód   • [         R                  " U R                  5      n[        5       Ul        U$ )z>
Return a L{TrialRunner} object that is safe to use in tests.
)r   r.   r+   r   r/   ©r?   r3   s     r    Ú
makeRunnerÚ&ForceGarbageCollectionTests.makeRunner¥   s&   € ô ×"Ò" 4§;¡;Ó/ˆÜ ›
ˆŒØˆr!   c                óè   • SU R                   S'   U R                   R                  5         U R                  5       nUR                  U R                  5        U R                  U R                  / SQ5        g)zs
Passing the --force-gc option to the trial script forces the garbage
collector to run before and after each test.
Tzforce-gc)r\   ra   r\   r\   ra   r\   N©r+   ÚpostOptionsrm   r2   ra   ÚassertEqualr]   rl   s     r    Útest_forceGcÚ(ForceGarbageCollectionTests.test_forceGc­   sV   € ð
 #'ˆ�‰�JÑØ�‰×ÑÔ!Ø—‘Ó"ˆØ�
‰
�4—9‘9ÔØ×ÑØ�H‰HÒRõ	
r!   c                óÊ   • U R                   R                  5         U R                  5       nUR                  U R                  5        U R                  U R                  SS/5        g)z.
By default, no garbage collection is forced.
ra   Nrp   rl   s     r    Útest_unforceGcÚ*ForceGarbageCollectionTests.test_unforceGcº   sI   € ð 	�‰×ÑÔ!Ø—‘Ó"ˆØ�
‰
�4—9‘9ÔØ×Ñ˜Ÿ™ F¨FÐ#3Õ4r!   )r+   r]   ra   N©rP   rQ   )rP   r   )rR   rS   rT   rU   rV   rb   r`   r\   rm   rs   rv   rW   r%   r!   r    rY   rY   �   s%   † ñô,ô ô#ôô
÷5r!   rY   c                  ó6   • \ rS rSrSrSS jrSS jrSS jrSrg)	ÚSuiteUsedTestséÄ   z7
Check the category of tests suite used by the loader.
c                ó8   • [         R                  " 5       U l        g)z&
Create a trial configuration object.
N©r   r(   r+   rg   s    r    rb   ÚSuiteUsedTests.setUpÉ   s   € ô —m’m“oˆ�r!   c                ó„   • [         R                  " U R                  5      nU R                  UR                  [
        5        g)z;
By default, the loader should use L{DestructiveTestSuite}
N)r   Ú
_getLoaderr+   rr   ÚsuiteFactoryr   ©r?   Úloaders     r    Útest_defaultSuiteÚ SuiteUsedTests.test_defaultSuiteÏ   s/   € ô ×!Ò! $§+¡+Ó.ˆØ×Ñ˜×,Ñ,Ô.BÕCr!   c                ó¢   • SU R                   S'   [        R                  " U R                   5      nU R                  UR                  [
        5        g)z_
The C{until-failure} configuration uses the L{TestSuite} to keep
instances alive across runs.
Tzuntil-failureN)r+   r   r€   rr   r�   r   r‚   s     r    Útest_untilFailureSuiteÚ%SuiteUsedTests.test_untilFailureSuiteÖ   s<   € ð
 (,ˆ�‰�OÑ$Ü×!Ò! $§+¡+Ó.ˆØ×Ñ˜×,Ñ,¬iÕ8r!   ©r+   Nrx   )	rR   rS   rT   rU   rV   rb   r„   r‡   rW   r%   r!   r    rz   rz   Ä   s   † ñô&ôD÷9r!   rz   c                  ó  • \ rS rSrSS jrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSS jrSrg) ÚTestModuleTestséà   c                ó8   • [         R                  " 5       U l        g ©Nr}   rg   s    r    rb   ÚTestModuleTests.setUpá   ó   € Ü—m’m“oˆ�r!   c                ó   • S U l         g rŽ   r‰   rg   s    r    ÚtearDownÚTestModuleTests.tearDownä   s	   € Øˆ�r!   c                óX   • U R                  [        U 5      U R                  5       /5        g)zY
Check that the testNames helper method accurately collects the
names of tests in suite.
N)rr   r   Úidrg   s    r    Útest_testNamesÚTestModuleTests.test_testNamesç   s    € ð
 	×Ñœ 4›¨4¯7©7«9¨+Õ6r!   c                óà   • [        5       n[        U5      n[        [        [        UR                  U5      5      5      nUR                  5         UR                  5         U R                  XE5        g rŽ   )r   r   r   ÚmapÚ
loadByNameÚsortrr   )r?   Útest1Únamesrƒ   Únames1Únames2s         r    ÚassertSuitesEqualÚ!TestModuleTests.assertSuitesEqualî   sO   € Ü“ˆÜ˜5Ó!ˆÜœ9¤S¨×):Ñ):¸EÓ%BÓCÓDˆØ�‰ŒØ�‰ŒØ×Ñ˜Õ(r!   c                óT   • U R                  S[        U R                  S   5      5        g )Nr   Útests)rr   Úlenr+   rg   s    r    Útest_baseStateÚTestModuleTests.test_baseStateö   s    € Ø×Ñ˜œC §¡¨GÑ 4Ó5Õ6r!   c                ó®   • U R                   R                  [        S5      5        U R                  [        R
                  " U R                   5      S/5        g)zt
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_testmoduler   r    r   Ú	_getSuiterg   s    r    Útest_testmoduleOnModuleÚ'TestModuleTests.test_testmoduleOnModuleù   s?   € ð
 	�‰×"Ñ"¤7¨?Ó#;Ô<Ø×ÑÜ�OŠO˜DŸK™KÓ(Ð+HÐ*Iõ	
r!   c                óö   • U R                   R                  [        S5      5        U R                   R                  [        S5      5        U R                  [        R
                  " U R                   5      S/5        g)zi
When the same module is specified with two --testmodule flags, it
should only appear once in the suite.
r¨   r©   Nrª   rg   s    r    Útest_testmoduleTwiceÚ$TestModuleTests.test_testmoduleTwice  sV   € ð
 	�‰×"Ñ"¤7¨?Ó#;Ô<Ø�‰×"Ñ"¤7¨?Ó#;Ô<Ø×ÑÜ�OŠO˜DŸK™KÓ(Ð+HÐ*Iõ	
r!   c                óö   • U R                   R                  [        S5      5        U R                   R                  [        S5      5        U R                  [        R
                  " U R                   5      S/5        g)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¨   ztest_log.pyr©   Nrª   rg   s    r    Ú test_testmoduleOnSourceAndTargetÚ0TestModuleTests.test_testmoduleOnSourceAndTarget  sV   € ð 	�‰×"Ñ"¤7¨?Ó#;Ô<Ø�‰×"Ñ"¤7¨=Ó#9Ô:Ø×ÑÜ�OŠO˜DŸK™KÓ(Ð+HÐ*Iõ	
r!   c                ó®   • U R                   R                  [        S5      5        U R                  [        R
                  " U R                   5      S/5        g)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.pyztwisted.trial.test.moduleselfNrª   rg   s    r    Útest_testmoduleOnSelfModuleÚ+TestModuleTests.test_testmoduleOnSelfModule  s?   € ð
 	�‰×"Ñ"¤7¨?Ó#;Ô<Ø×ÑÜ�OŠO˜DŸK™KÓ(Ð+JÐ*Kõ	
r!   c                ó°   • U R                   R                  [        S5      5        U R                  [        R
                  " U R                   5      SS/5        g)zU
Check that --testmodule loads tests referred to in test-case-name
buffer variables.
úscripttest.pyr©   útwisted.trial.test.test_runnerNrª   rg   s    r    Útest_testmoduleOnScriptÚ'TestModuleTests.test_testmoduleOnScript$  sB   € ð
 	�‰×"Ñ"¤7¨?Ó#;Ô<Ø×ÑÜ�OŠO˜DŸK™KÓ(Ø*Ð,LÐMõ	
r!   c                ó\  • [        5       n[        R                  Usn[        l        Sn U R                  R	                  U5        U R                  S[        U R                  S   5      5        U R                  SU< S3UR                  5       5        U[        l        g! U[        l        f = f)zb
Check that --testmodule displays a meaningful error message when
passed a non-existent filename.
ztest_thisbetternoteverexist.pyr   r£   úFile ú doesn't exist
N©r   ÚsysÚstderrr+   r«   rr   r¤   Úgetvalue)r?   ÚbuffyrÂ   r   s       r    Ú test_testmoduleOnNonexistentFileÚ0TestModuleTests.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                óœ   • U R                   R                  [        S5      5        U R                  S[	        U R                   S   5      5        g)zl
Check that --testmodule adds no tests to the suite for modules
which lack test-case-name buffer variables.
ú	novars.pyr   r£   N)r+   r«   r   rr   r¤   rg   s    r    Útest_testmoduleOnEmptyVarsÚ*TestModuleTests.test_testmoduleOnEmptyVars>  s9   € ð
 	�‰×"Ñ"¤7¨;Ó#7Ô8Ø×Ñ˜œC §¡¨GÑ 4Ó5Õ6r!   c                ó\  • [        5       n[        R                  Usn[        l        Sn U R                  R	                  U5        U R                  S[        U R                  S   5      5        U R                  SU< S3UR                  5       5        U[        l        g! U[        l        f = f)zw
Check that --testmodule does *not* support module names as arguments
and that it displays a meaningful error message.
ztwisted.trial.test.test_scriptr   r£   r¾   r¿   NrÀ   )r?   rÄ   rÂ   Ú
moduleNames       r    Útest_testmoduleOnModuleNameÚ+TestModuleTests.test_testmoduleOnModuleNameF  s‡   € ô
 “
ˆÜ Ÿ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                ó\   • Sn[         R                  " U5      nU R                  SS0U5        g )Nz5-*- test-case-name: twisted.trial.test.test_tests -*-útest-case-nameútwisted.trial.test.test_tests©r   Ú_parseLocalVariablesrr   ©r?   ÚdeclarationÚ	localVarss      r    Útest_parseLocalVariableÚ'TestModuleTests.test_parseLocalVariableU  s.   € ØMˆÜ×.Ò.¨{Ó;ˆ	Ø×ÑÐ*Ð,KÐLÈiÕXr!   c                ó\   • Sn[         R                  " U5      nU R                  SS0U5        g )Nz6-*- test-case-name: twisted.trial.test.test_tests; -*-rÑ   rÒ   rÓ   rÕ   s      r    Útest_trailingSemicolonÚ&TestModuleTests.test_trailingSemicolonZ  s.   € ØNˆÜ×.Ò.¨{Ó;ˆ	Ø×ÑÐ*Ð,KÐLÈiÕXr!   c                ó^   • Sn[         R                  " U5      nU R                  SSS.U5        g )Nz?-*- test-case-name: twisted.trial.test.test_tests; foo: bar -*-rÒ   Úbar)rÑ   ÚfoorÓ   rÕ   s      r    Útest_parseLocalVariablesÚ(TestModuleTests.test_parseLocalVariables_  s4   € àPð 	ô ×.Ò.¨{Ó;ˆ	Ø×ÑØ>ÀuÑMÈyõ	
r!   c                ó\   • Sn[         R                  " U5      nU R                  SS0U5        g )Nz:## -*- test-case-name: twisted.trial.test.test_tests -*- #rÑ   rÒ   rÓ   rÕ   s      r    Útest_surroundingGuffÚ$TestModuleTests.test_surroundingGuffh  s.   € ØUˆÜ×.Ò.¨{Ó;ˆ	Ø×ÑÐ*Ð,KÐLÈiÕXr!   c                óN   • U R                  [        [        R                  S5        g ©Nrß   ©ÚassertRaisesÚ
ValueErrorr   rÔ   rg   s    r    Útest_invalidLineÚ TestModuleTests.test_invalidLinem  s   € Ø×Ñœ*¤e×&@Ñ&@À%ÕHr!   c                óâ   • U R                  [        [        R                  S5        U R                  [        [        R                  S5        U R                  [        [        R                  S5        g )Nz-*- foo -*-z-*- foo: bar; qux -*-z-*- foo: bar: baz; qux: qax -*-rç   rg   s    r    Útest_invalidDeclarationÚ'TestModuleTests.test_invalidDeclarationp  sT   € Ø×Ñœ*¤e×&@Ñ&@À-ÔPØ×ÑÜœ×2Ñ2Ð4Kô	
ð 	×ÑÜœ×2Ñ2Ð4Uõ	
r!   c                ój   • [         R                  " [        S5      5      nU R                  SS0U5        g )Nr¨   rÑ   r©   ©r   ÚloadLocalVariablesr   rr   ©r?   r×   s     r    Útest_variablesFromFileÚ&TestModuleTests.test_variablesFromFiley  s.   € Ü×,Ò,¬W°_Ó-EÓFˆ	Ø×ÑÐ*Ð,IÐJÈIÕVr!   c                óf   • [         R                  " [        S5      5      nU R                  0 U5        g )NrÉ   rð   rò   s     r    Útest_noVariablesInFileÚ&TestModuleTests.test_noVariablesInFile}  s'   € Ü×,Ò,¬W°[Ó-AÓBˆ	Ø×Ñ˜˜YÕ'r!   c                ój   • [         R                  " [        S5      5      nU R                  SS0U5        g )Nr¹   rÑ   z:twisted.trial.test.test_log,twisted.trial.test.test_runnerrð   rò   s     r    Útest_variablesFromScriptÚ(TestModuleTests.test_variablesFromScript�  s5   € Ü×,Ò,¬W°_Ó-EÓFˆ	Ø×Ñà ØSðð
 õ	
r!   c                óh   • [         R                  " [        S5      5      nU R                  US/5        g )Nr¨   r©   )r   ÚgetTestModulesr   rr   ©r?   Úmoduless     r    Útest_getTestModulesÚ#TestModuleTests.test_getTestModulesŒ  s+   € Ü×&Ò&¤w¨Ó'?Ó@ˆØ×Ñ˜Ð#@Ð"AÕBr!   c                óx   • [         R                  " [        S5      5      nU R                  [	        U5      S5        g )NrÉ   r   )r   rü   r   rr   r¤   rý   s     r    Útest_getTestModules_noVarsÚ*TestModuleTests.test_getTestModules_noVars�  s+   € Ü×&Ò&¤w¨{Ó';Ó<ˆØ×Ñœ˜W› qÕ)r!   c                ó|   • [         R                  " [        S5      5      nU R                  [	        U5      SS15        g )Nr¹   r©   rº   )r   rü   r   rr   Úsetrý   s     r    Útest_getTestModules_multipleÚ,TestModuleTests.test_getTestModules_multiple”  s5   € Ü×&Ò&¤w¨Ó'?Ó@ˆØ×ÑÜ�‹LØ*Ð,LÐMõ	
r!   c                óú   • S H-  nU R                  [        R                  " U5      U< S35        M/     S[        S5      [        S5      4 H-  nU R	                  [        R                  " U5      U< S35        M/     g )N)ztest_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?   r   s     r    Útest_looksLikeTestModuleÚ(TestModuleTests.test_looksLikeTestModule›  s|   € ÛOˆHØ�O‰OÜ× Ò  Ó*Ø‘,Ð4Ð5öñ Pð /Ü�OÓ$Ü�NÓ#ó
ˆHð
 ×ÑÜ× Ò  Ó*Ø‘,Ð:Ð;öò
r!   r‰   Nrx   )rœ   r   r�   z	list[str]rP   rQ   )rR   rS   rT   rU   rb   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  rW   r%   r!   r    r‹   r‹   à   sŠ   † ô&ôô7ô)ô7ô
ô	
ô

ô
ô	
ô ô7ô ôYô
Yô

ôYô
Iô
ôWô(ô	
ôCô*ô
÷r!   r‹   c                  ó^   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrS
rg)ÚWithoutModuleTestsi¬  z"
Test the C{without-module} flag.
c                ót   • [         R                  " 5       U l        [        [        R
                  5      U l        g)zT
Create a L{trial.Options} object to be used in the tests, and save
C{sys.modules}.
N)r   r(   r+   ÚdictrÁ   rþ   ÚsavedModulesrg   s    r    rb   ÚWithoutModuleTests.setUp±  s"   € ô
 —m’m“oˆŒÜ ¤§¡Ó-ˆÕr!   c                ó¸   • S HT  nXR                   ;   a"  U R                   U   [        R                  U'   M4  [        R                  R                  US5        MV     g)z
Restore C{sys.modules}.
)ÚimaplibÚsmtplibN)r  rÁ   rþ   Úpop)r?   Úmodules     r    r’   ÚWithoutModuleTests.tearDown¹  sE   € ó -ˆFØ×*Ñ*Ó*Ø&*×&7Ñ&7¸Ñ&?”—‘˜FÓ#ä—‘—‘ ¨Ö-ò	 -r!   c                ó   • SSK nU$ )z5
Try to import the C{smtplib} module, and return it.
r   N)r  )r?   r  s     r    Ú
_checkSMTPÚWithoutModuleTests._checkSMTPÃ  ó   € ó 	àˆr!   c                ó   • SSK nU$ )z5
Try to import the C{imaplib} module, and return it.
r   N)r  )r?   r  s     r    Ú
_checkIMAPÚWithoutModuleTests._checkIMAPË  r  r!   c                óü   • U R                   R                  SS/5        U R                  [        U R                  5        [
        R                  S	 U R                  U R	                  5       [        R                  5        g)zD
Check that after disabling a module, it can't be imported anymore.
ú--without-moduler  N)
r+   r)   rè   ÚImportErrorr  rÁ   rþ   ÚassertIsInstanceÚtypesÚ
ModuleTyperg   s    r    Útest_disableOneModuleÚ(WithoutModuleTests.test_disableOneModuleÓ  sY   € ð 	�‰× Ñ Ð"4°iÐ!@ÔAØ×Ñœ+ t§¡Ô7ä�K‰K˜	Ð"à×Ñ˜dŸo™oÓ/´×1AÑ1AÕBr!   c                óº  • U R                   R                  SS/5        U R                  [        U R                  5        U R                  [        U R
                  5        [        R                  S	 [        R                  S	 U R                  U R	                  5       [        R                  5        U R                  U R                  5       [        R                  5        g)z5
Check that several modules can be disabled at once.
r"  zsmtplib,imaplibr  r  N)r+   r)   rè   r#  r  r  rÁ   rþ   r$  r%  r&  rg   s    r    Útest_disableMultipleModulesÚ.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                ó  • U R                  U R                  5       [        R                  5        U R	                  [
        S[        R                  U R                  R                  SS/5        U R                  [        U R                  5        g)z@
Disabling an already imported module should produce a warning.
z4Module 'smtplib' already imported, disabling anyway.r"  r  N)r$  r  r%  r&  ÚassertWarnsÚRuntimeWarningr   r   r+   r)   rè   r#  rg   s    r    Ú!test_disableAlreadyImportedModuleÚ4WithoutModuleTests.test_disableAlreadyImportedModuleì  sg   € ð 	×Ñ˜dŸo™oÓ/´×1AÑ1AÔBØ×ÑÜØBÜ�N‰NØ�K‰K×$Ñ$Ø Ð+ô	
ð 	×Ñœ+ t§¡Õ7r!   )r+   r  Nrx   )rP   Úobject)rR   rS   rT   rU   rV   rb   r’   r  r  r'  r*  r/  rW   r%   r!   r    r  r  ¬  s,   † ñô.ô.ôôô	CôC÷8r!   r  c                  óÒ   • \ rS rSrSr\R                  SS S:¬  r\" \	SS5      SLr
\" \(       + S5      SS j5       r\" \=(       d    \
(       + S	5      SS
 j5       rSS jrSS jrSrg)ÚAutoJobsTestsiû  z(
Test {twisted.scripts.trial._autoJobs}
Né   )é   é   Úsched_getaffinityzRequires os.process_cpu_count()c                óx   • [         R                  " 5       nU R                  [        R                  " 5       U5        g)z\
When `os.process_cpu_count()` is available (Python 3.13+), `_autoJobs`
returns its result.
N)ÚosÚprocess_cpu_countrr   r   Ú	_autoJobs)r?   Úcounts     r    Útest_processCpuCountÚ"AutoJobsTests.test_processCpuCount  s)   € ô ×$Ò$Ó&ˆØ×ÑœŸšÓ*¨EÕ2r!   z>Requires os.sched_getaffinity() without os.process_cpu_count()c                óˆ   • U R                  [        R                  " 5       [        [        R
                  " S5      5      5        g)zè
When `os.sched_getaffinity()` is available but `os.process_cpu_count()`
is not (Python 3.3 through Python 3.12 on "some Unix platforms"),
`_autoJobs` uses it to returns the number of CPUs that the current
process is restricted to.
r   N)rr   r   r;  r¤   r9  r7  rg   s    r    Útest_schedGetAffinityÚ#AutoJobsTests.test_schedGetAffinity  s+   € ð 	×ÑœŸšÓ*¬C´×0DÒ0DÀQÓ0GÓ,HÕIr!   c                ót   • U R                  [        R                  " 5       [        R                  " 5       5        g)zJ
When only `os.cpu_count()` is available, `_autoJobs` returns
its result.
N)rr   r   r;  r9  Ú	cpu_countrg   s    r    Útest_cpuCountÚAutoJobsTests.test_cpuCount  s!   € ð
 	×ÑœŸšÓ*¬B¯LªL«NÕ;r!   c                ó"  • U R                   (       a  U R                  [        SS 5        U R                  (       a  U R                  [        SS 5        U R                  [        SS 5        U R	                  [
        R                  " 5       S5        g)	z¿
When `os.cpu_count()` returns L{None}, `_autoJobs`
rounds up to 1.

This test relies on patching because all platforms currently
supported by Twisted provide a functioning `os.cpu_count()`.
r:  c                 ó   • g rŽ   r%   r%   r!   r    Ú<lambda>Ú4AutoJobsTests.test_cpuCountUnknown.<locals>.<lambda>)  s   € ¸r!   r7  c                ó   • [        5       $ rŽ   )r  )Úpids    r    rH  rI  +  s   € ¼C¼Er!   rC  c                 ó   • g rŽ   r%   r%   r!   r    rH  rI  ,  s   € ¨Dr!   r   N)ÚhasProcessCpuCountr^   r9  ÚhasSchedGetaffinityrr   r   r;  rg   s    r    Útest_cpuCountUnknownÚ"AutoJobsTests.test_cpuCountUnknown   s`   € ð ×"×"Ø�J‰J”rÐ.±Ô=Ø×#×#Ø�J‰J”rÐ.Ñ0AÔBØ�
‰
”2�{¡LÔ1à×ÑœŸšÓ*¨AÕ.r!   r%   rx   )rR   rS   rT   rU   rV   rÁ   Úversion_inforM  Úgetattrr9  rN  r   r=  r@  rD  rO  rW   r%   r!   r    r3  r3  û  s‰   † ñð ×)Ñ)¨"¨1Ð-°Ñ8ÐÙ! "Ð&9¸4Ó@ÈÐLÐáÐ"Ô"Ð$EÓFó3ó Gð3ñ Ø×5Ð"5Ô5ØHóóJó	ðJô<÷/r!   r3  c                  óZ   • \ rS rSrSr\" \SS5      c  SrSS jrSS jr	SS jr
SS	 jrS
rg)ÚCoverageTestsi1  z#
Tests for the I{coverage} option.
ÚgettraceNz;Cannot test trace hook installation without inspection API.c                ój   • U R                  [        R                  [        R                  " 5       5        g)zN
Arrange for the current trace hook to be restored when the
test is complete.
N)Ú
addCleanuprÁ   ÚsettracerU  rg   s    r    rb   ÚCoverageTests.setUp9  s   € ð
 	�‰œŸ™¤c§l¢l£nÕ5r!   c                óâ   • [         R                  " 5       nUR                  S/5        UR                  c   eU R	                  [
        R                  " 5       UR                  R                  5        g)ze
L{trial.Options} handles C{"--coverage"} by installing a trace
hook to record coverage information.
z
--coverageN)r   r(   r)   Útracerrr   rÁ   rU  Úglobaltrace©r?   Úoptionss     r    Útest_tracerInstalledÚ"CoverageTests.test_tracerInstalled@  sS   € ô
 —-’-“/ˆØ×Ñ˜l˜^Ô,Ø�~‰~Ñ)Ð)Ð)Ø×ÑÜ�LŠL‹Nà�N‰N×&Ñ&õ	
r!   c                ó¨   • [         R                  " 5       nU R                  UR                  5       [	        S5      R                  US   S/5      5        g)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.
rJ   rF   ÚcoverageN)r   r(   rr   Úcoverdirr   Ú
descendantr]  s     r    Útest_coverdirDefaultÚ"CoverageTests.test_coverdirDefaultN  sF   € ô
 —-’-“/ˆØ×ÑØ×ÑÓÜ�S‹M×$Ñ$ gÐ.>Ñ&?ÀÐ%LÓMõ	
r!   c                óä   • U R                  5       n[        R                  " 5       nUR                  SU/5        U R	                  UR                  5       [        U5      R                  S5      5        g)zs
If a value is specified for the I{temp-directory} option,
L{trial.Options.coverdir} returns a child of that path.
r:   rb  N)Úmktempr   r(   r)   rr   rc  r   Úchild)r?   rK   r^  s      r    Útest_coverdirOverriddenÚ%CoverageTests.test_coverdirOverriddenY  sV   € ð
 �{‰{‹}ˆÜ—-’-“/ˆØ×ÑÐ0°$Ð7Ô8Ø×Ñ˜×)Ñ)Ó+¬X°d«^×-AÑ-AÀ*Ó-MÕNr!   r%   rx   )rR   rS   rT   rU   rV   rR  rÁ   Úskiprb   r_  re  rj  rW   r%   r!   r    rT  rT  1  s2   † ññ ˆs�J Ó%Ñ-ØLˆô6ô
ô	
÷Or!   rT  c                  óT   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
S	rg
)ÚOptionsTestsid  z
Tests for L{trial.Options}.
c                ó8   • [         R                  " 5       U l        g)z5
Build an L{Options} object to be used in the tests.
N©r   r(   r^  rg   s    r    rb   ÚOptionsTests.setUpi  s   € ô —}’}“ˆ�r!   c                ó¸  • U R                  [        R                  [        R                  " 5       5        [        R
                  " 5       (       a  U R                  [        R                  5        U R                  R                  / SQ5        U R                  R                  5       nU R                  SU5        UR                  S5        U R                  SS/U5        g)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ú--disablegcrw  rs  rt  N)rW  rÁ   ÚsetrecursionlimitÚgetrecursionlimitr_   Ú	isenabledÚenabler^  r)   Ú_getWorkerArgumentsÚassertInÚremoverr   )r?   Úargss     r    Útest_getWorkerArgumentsÚ$OptionsTests.test_getWorkerArgumentso  s•   € ð 	�‰œ×-Ñ-¬s×/DÒ/DÓ/FÔGÜ�<Š<�>‰>Ø�O‰OœBŸI™IÔ&à�‰×!Ñ!ÚHô	
ð �|‰|×/Ñ/Ó1ˆØ�‰�m TÔ*Ø�‰�MÔ"Ø×ÑÐ,¨fÐ5°tÕ<r!   c                ó”   • U R                  [        U R                  R                  / SQ5      nU R	                  S[        U5      5        g)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}
)ú--jobsrv  ú--debugz+You can't specify --debug when using --jobsN©rè   r   r^  r)   rr   rO   ©r?   Úerrors     r    Útest_jobsConflictWithDebugÚ'OptionsTests.test_jobsConflictWithDebug�  s=   € ð ×!Ñ!Ü˜Ÿ™×1Ñ1Ò3Mó
ˆð 	×ÑÐFÌÈEË
ÕSr!   c                ó”   • U R                  [        U R                  R                  / SQ5      nU R	                  S[        U5      5        g)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ƒ  rv  z	--profilez-You can't specify --profile when using --jobsNr…  r†  s     r    Útest_jobsConflictWithProfileÚ)OptionsTests.test_jobsConflictWithProfile�  s=   € ð ×!Ñ!Ü˜Ÿ™×1Ñ1Ò3Oó
ˆð 	×ÑÐHÌ#ÈeË*ÕUr!   c                ó”   • U R                  [        U R                  R                  / SQ5      nU R	                  S[        U5      5        g)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ƒ  rv  z--debug-stacktracesz7You can't specify --debug-stacktraces when using --jobsNr…  r†  s     r    Ú%test_jobsConflictWithDebugStackTracesÚ2OptionsTests.test_jobsConflictWithDebugStackTraces™  s@   € ð ×!Ñ!ÜØ�L‰L×%Ñ%Ú2ó
ˆð
 	×ÑØEÄsÈ5Ãzõ	
r!   c                ó”   • U R                  [        U R                  R                  / SQ5      nU R	                  S[        U5      5        g)zZ
C{parseOptions} raises a C{UsageError} when C{--order} is passed along
with C{--random}.
)ú--orderÚalphabeticalru  Ú1234z-You can't specify --random when using --orderNr…  r†  s     r    Útest_orderConflictWithRandomÚ)OptionsTests.test_orderConflictWithRandom©  s>   € ð
 ×!Ñ!ÜØ�L‰L×%Ñ%Ú;ó
ˆð
 	×ÑÐHÌ#ÈeË*ÕUr!   ©r^  Nrx   )rR   rS   rT   rU   rV   rb   r€  rˆ  r‹  rŽ  r”  rW   r%   r!   r    rn  rn  d  s(   † ñô'ô=ô$
Tô
Vô
÷ 
Vr!   rn  c                  óh   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSrg)ÚMakeRunnerTestsi¶  z&
Tests for the L{_makeRunner} helper.
c                ó8   • [         R                  " 5       U l        g rŽ   rp  rg   s    r    rb   ÚMakeRunnerTests.setUp»  s   € Ü—}’}“ˆ�r!   c                óJ  • U R                   R                  / SQ5        [        R                  " U R                   5      n[	        U[
        5      (       d   eU R                  U[
        5        U R                  SUR                  5        U R                  S/UR                  5        g)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ƒ  rv  ú
--force-gcé   rœ  N)
r^  r)   r   r.   Ú
isinstancer   r$  rr   Ú_maxWorkersÚ_workerArgumentsrl   s     r    Ú	test_jobsÚMakeRunnerTests.test_jobs¾  s|   € ð 	�‰×!Ñ!Ò"?Ô@Ü×"Ò" 4§<¡<Ó0ˆÜ˜&¤/×2Ñ2Ð2Ð2Ø×Ñ˜f¤oÔ6Ø×Ñ˜˜F×.Ñ.Ô/Ø×Ñ˜,˜¨×)@Ñ)@ÕAr!   c                ó”   • U R                  [        U R                  R                  SS/5      nU R	                  S[        U5      5        g)zP
C{parseOptions} raises a C{UsageError} when C{--jobs} is passed a non-integer.
rƒ  Únanz-Expecting integer argument to jobs, got 'nan'Nr…  ©r?   Úexcs     r    Útest_jobsNotANumberÚ#MakeRunnerTests.test_jobsNotANumberË  sA   € ð ×ÑÜ˜Ÿ™×1Ñ1°H¸eÐ3Dó
ˆð 	×ÑÐHÌ#ÈcË(ÕSr!   c                ó”   • U R                  [        U R                  R                  SS/5      nU R	                  S[        U5      5        g)zY
C{parseOptions} raises a C{UsageError} when C{--jobs} is passed a non-positive
integer.
rƒ  Ú0z>Argument to jobs must be a strictly positive integer or 'auto'Nr…  r¥  s     r    Útest_jobsNonPositiveÚ$MakeRunnerTests.test_jobsNonPositiveÔ  s?   € ð
 ×Ñ¤
¨D¯L©L×,EÑ,EÈÐRUÀÓWˆØ×ÑØLÌcÐRUËhõ	
r!   c                ó  • U R                  [        SS 5        [        R                  " 5       nUR                  SS/5        [        R                  " U5      n[        U[        5      (       d   eU R                  SUR                  5        g)z6
C{--jobs auto} guesses the number of workers to use.
r;  c                 ó   • g)Nr8   r%   r%   r!   r    rH  ÚEMakeRunnerTests.test_autoDetectAvailableCpusForJobs.<locals>.<lambda>â  s   € ¨rr!   rƒ  Úautor8   N)	r^   r   r(   r)   r.   rž  r   rr   rŸ  )r?   r^  r3   s      r    Ú#test_autoDetectAvailableCpusForJobsÚ3MakeRunnerTests.test_autoDetectAvailableCpusForJobsÞ  sk   € ð 	�
‰
”5˜+¡zÔ2ä—-’-“/ˆØ×Ñ˜h¨Ð/Ô0Ü×"Ò" 7Ó+ˆä˜&¤/×2Ñ2Ð2Ð2Ø×Ñ˜˜V×/Ñ/Õ0r!   c                ó,  • U R                   R                  / SQ5        [        R                  " U R                   5      n[	        U[
        5      (       d   eU R                  U[
        5        U R                  [
        R                  UR                  5        g)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ƒ  rv  z	--dry-runN)
r^  r)   r   r.   rž  r   r$  rr   ÚDRY_RUNÚmoderl   s     r    Útest_dryRunWithJobsÚ#MakeRunnerTests.test_dryRunWithJobsë  sh   € ð
 	�‰×!Ñ!Ò">Ô?Ü×"Ò" 4§<¡<Ó0ˆÜ˜&¤+×.Ñ.Ð.Ð.Ø×Ñ˜f¤kÔ2Ø×Ñœ×,Ñ,¨f¯k©kÕ:r!   c                ó:  ^• [         R                  R                  mSU4S jjnU R                  [         R                  SU5        [         R                  " 5       nUR                  / SQ5        U R                  [         R                  [         R                  U5        g )Nc                ó^   >• U S:X  a  [         R                  R                  U 5      eT" U 5      $ )NÚ	doNotFind)r   ÚreflectÚModuleNotFound)ÚfqnÚnamedAnys    €r    ÚnamedAnyExceptdoNotFindÚFMakeRunnerTests.test_DebuggerNotFound.<locals>.namedAnyExceptdoNotFindù  s*   ø€ Ø�kÓ!Ü—m‘m×2Ñ2°3Ó7Ð7Ù˜C“=Ð r!   r¾  )r„  z
--debuggerrº  )r½  rO   rP   r1  )	r   r»  r¾  r^   r(   r)   rè   Ú_DebuggerNotFoundr.   )r?   r¿  r^  r¾  s      @r    Útest_DebuggerNotFoundÚ%MakeRunnerTests.test_DebuggerNotFoundö  sf   ø€ Ü—=‘=×)Ñ)ˆ÷	!ð
 	�
‰
”5—=‘= *Ð.EÔFä—-’-“/ˆØ×ÑÒCÔDà×Ñœ%×1Ñ1´5×3DÑ3DÀgÕNr!   c                óà   • U R                   R                  S/5        [        R                  " U R                   5      n[	        U[
        5      (       d   eU R                  UR                  5        g)zj
Passing C{--exitfirst} wraps the reporter with a
L{reporter._ExitWrapper} that stops on any non-success.
z--exitfirstN)r^  r)   r   r.   rž  r   r	  Ú
_exitFirstrl   s     r    Útest_exitfirstÚMakeRunnerTests.test_exitfirst  sQ   € ð
 	�‰×!Ñ! = /Ô2Ü×"Ò" 4§<¡<Ó0ˆÜ˜&¤+×.Ñ.Ð.Ð.Ø�‰˜×)Ñ)Õ*r!   r–  Nrx   )rR   rS   rT   rU   rV   rb   r¡  r§  r«  r±  r¶  rÂ  rÆ  rW   r%   r!   r    r˜  r˜  ¶  s2   † ñô'ôBôTô
ô1ô	;ôO÷+r!   r˜  c                  ó,   • \ rS rSrSrSS jrSS jrSrg)ÚRunTestsi  z 
Tests for the L{run} function.
c                óH   • U R                  [        R                  SS 5        g )Nr)   c                ó   • g rŽ   r%   rg   s    r    rH  Ú RunTests.setUp.<locals>.<lambda>  s   € ¸tr!   )r^   r   r(   rg   s    r    rb   ÚRunTests.setUp  s   € ð 	�
‰
”5—=‘= .Ñ2CÕDr!   c                óî   • SS jnU R                  [        SU5         [        R                  " 5         U R                  S5        g! [         a%  nU R                  S[        U5      5         SnAgSnAff = f)zI
When a debugger is not found, an error message is printed to the user.

c                 ó.   • [         R                  " S5      eræ   )r   rÁ  )r  Úkwargss     r    r.   Ú3RunTests.test_debuggerNotFound.<locals>._makeRunner   s   € Ü×)Ò)¨%Ó0Ð0r!   r.   z0Should have exited due to non-existent debugger!rß   N)r  r1  rÐ  r1  rP   rQ   )r^   r   r2   ÚfailÚ
SystemExitr}  rO   )r?   r.   Úes      r    Útest_debuggerNotFoundÚRunTests.test_debuggerNotFound  s^   € ô	1ð 	�
‰
”5˜-¨Ô5ð	JÜ�IŠIŒKð �I‰IÐHÕIøô ó 	)Ø�M‰M˜%¤ Q£×(Ñ(ûð	)ús   žA Á
A4ÁA/Á/A4r%   Nrx   )rR   rS   rT   rU   rV   rb   rÕ  rW   r%   r!   r    rÉ  rÉ    s   † ñôE÷
Jr!   rÉ  c                  ó,   • \ rS rSrSrSS jrSS jrSrg)ÚTestArgumentOrderTestsi-  zI
Tests for the order-preserving behavior on provided command-line tests.
c                óV   • [         R                  " 5       U l        [        5       U l        g rŽ   )r   r(   r+   r   rƒ   rg   s    r    rb   ÚTestArgumentOrderTests.setUp2  s   € Ü—m’m“oˆŒÜ “lˆ�r!   c                ó"  • / SQnU R                   R                  U5        [        R                  " U R                   5      n[	        U5      n[        [        U R                  R                  U5      5      n[	        U5      nU R                  X55        g)z>
Multiple tests passed on the command line are not reordered.
)rÒ   z"twisted.trial.test.test_assertionsz twisted.trial.test.test_deferredN)
r+   r)   r   r¬   r   r   r™   rƒ   rš   rr   )r?   r£   r4   r�   ÚexpectedSuiteÚexpectedNamess         r    Útest_preserveArgumentOrderÚ1TestArgumentOrderTests.test_preserveArgumentOrder6  sl   € ò
ˆð
 	�‰× Ñ  Ô'ä—’ §¡Ó,ˆÜ˜%Ó ˆä!¤# d§k¡k×&<Ñ&<¸eÓ"DÓEˆÜ! -Ó0ˆà×Ñ˜Õ.r!   )r+   rƒ   Nrx   )rR   rS   rT   rU   rV   rb   rÞ  rW   r%   r!   r    rØ  rØ  -  s   † ñô#÷/r!   rØ  c                  ór   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jrSrg)Ú
OrderTestsiJ  z
Tests for the --order option.
c                ó8   • [         R                  " 5       U l        g rŽ   r}   rg   s    r    rb   ÚOrderTests.setUpO  r�   r!   c                óô   • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      nU R                  [        U5      / SQ5        g)zV
--order=alphabetical causes trial to run tests alphabetically within
each test case.
)r‘  r’  ú%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)   r   r€   ÚloadByNamesrr   r   ©r?   rƒ   r4   s      r    Útest_alphabeticalÚOrderTests.test_alphabeticalR  sc   € ð
 	�‰× Ñ ÚPô	
ô ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆà×ÑÜ�eÓòõ	
r!   c                óô   • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      nU R                  [        U5      / SQ5        g)z]
--order=alphabetical causes trial to run test classes within a given
module alphabetically.
)r‘  r’  útwisted.trial.test.ordertestsr£   )ú.twisted.trial.test.ordertests.BarTest.test_barú.twisted.trial.test.ordertests.BazTest.test_bazræ  rç  rè  ré  Nrê  rì  s      r    Útest_alphabeticalModuleÚ"OrderTests.test_alphabeticalModuleh  sc   € ð
 	�‰× Ñ ÚHô	
ô ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆà×ÑÜ�eÓòõ
	
r!   c                ó&  • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      n[        U5      nU R                  USS9  U R                  U[        U5      5        g)zŠ
--order=alphabetical causes trial to run test modules within a given
package alphabetically, with tests within each module alphabetized.
)r‘  r’  útwisted.trial.testr£   zFailed to load any tests!©ÚmsgN)	r+   r)   r   r€   rë  r   r	  rr   Úsorted©r?   rƒ   r4   r�   s       r    Útest_alphabeticalPackageÚ#OrderTests.test_alphabeticalPackage  ss   € ð
 	�‰× Ñ Ò!RÔSÜ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆä˜%Ó ˆØ�‰˜Ð#>ˆÑ?Ø×Ñ˜¤ u£Õ.r!   c                óô   • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      nU R                  [        U5      / SQ5        g)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.
)r‘  Útoptobottområ  r£   )ræ  rè  ré  rç  Nrê  rì  s      r    Útest_toptobottomÚOrderTests.test_toptobottomŒ  sc   € ð 	�‰× Ñ ÚOô	
ô ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆà×ÑÜ�eÓòõ	
r!   c                óô   • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      nU R                  [        U5      / SQ5        g)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.
©r‘  rþ  rð  r£   )ræ  rè  ré  rç  rò  rñ  Nrê  rì  s      r    Útest_toptobottomModuleÚ!OrderTests.test_toptobottomModule£  sc   € ð
 	�‰× Ñ ÚGô	
ô ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆà×ÑÜ�eÓòõ
	
r!   c                ó  • U R                   R                  / SQ5        [        R                  " U R                   5      nUR	                  U R                   S   5      n[        U5      nU R                  U[        US S95        g)zŽ
--order=toptobottom causes trial to run test modules within a given
package alphabetically, with tests within each module run top to
bottom.
)r‘  rþ  rö  r£   c                ó*   • U R                  S5      S S $ )NrJ   r�  )Úsplit)Únames    r    rH  Ú4OrderTests.test_toptobottomPackage.<locals>.<lambda>É  s   € ¨4¯:©:°c«?¸2¸AÑ+>r!   )ÚkeyN)r+   r)   r   r€   rë  r   rr   rù  rú  s       r    Útest_toptobottomPackageÚ"OrderTests.test_toptobottomPackageº  sl   € ð 	�‰× Ñ Ò!QÔRÜ×!Ò! $§+¡+Ó.ˆØ×"Ñ" 4§;¡;¨wÑ#7Ó8ˆä˜%Ó ˆð 	×ÑØÜ�5Ñ>Ñ?õ	
r!   c                óâ  • U R                  5       n[        U5      R                  S5      nUR                  5         UR                  S5      R	                  S5        UR                  S5      R	                  [
        R                  " S5      R                  S5      5        UR                  5       R                  n[        R                  R                  SU5        U R                  [        R                  R                  U5        SSKJn  U R                  [        R                   R"                  S5        U R                  [        R                   R"                  UR$                  5        UR                  S5      R                  5         U R&                  R)                  / S	Q5        [*        R,                  " U R&                  5      nUR/                  U5      nU R1                  [3        U5      / S
Q5        g)zc
--order=toptobottom detects the source line of methods from modules
whose source file is missing.
Útwisted_toptobottom_tempz__init__.pyr!   ztest_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)rh  r   ri  ÚmakedirsÚ
setContentÚtextwrapÚdedentÚencodeÚparentrK   rÁ   ÚinsertrW  r~  r  r  rþ   r  rR   r+   r)   r   r€   Ú
loadModulerr   r   )r?   ÚtempdirÚpackageÚ	pathEntryr  rƒ   r4   s          r    Útest_toptobottomMissingSourceÚ(OrderTests.test_toptobottomMissingSourceÌ  s^  € ð
 —+‘+“-ˆÜ˜7Ó#×)Ñ)Ð*DÓEˆØ×ÑÔØ�‰�mÓ$×/Ñ/°Ô4Ø�‰Ð'Ó(×3Ñ3Ü�OŠOðó	÷ ‰f�V‹nô	
ð —N‘NÓ$×)Ñ)ˆ	Ü�‰�‰˜˜9Ô%Ø�‰œŸ™Ÿ™¨Ô3õ	
ð 	�‰œŸ™Ÿ™Ð)CÔDØ�‰œŸ™Ÿ™¨×)>Ñ)>Ô?Ø�‰Ð'Ó(×/Ñ/Ô1à�‰× Ñ ÚGô	
ô ×!Ò! $§+¡+Ó.ˆØ×!Ñ! ,Ó/ˆà×ÑÜ�eÓòõ	
r!   c                ó^   • U R                  [        U R                  R                  SS/5        g)z<
An unknown order passed to --order raises a L{UsageError}.
r‘  zI don't existN)rè   r   r+   r)   rg   s    r    Útest_unknownOrderÚOrderTests.test_unknownOrderü  s(   € ð
 	×ÑÜ˜Ÿ™×0Ñ0°9¸oÐ2Nõ	
r!   r‰   Nrx   )rR   rS   rT   rU   rV   rb   rí  ró  rû  rÿ  r  r  r  r  rW   r%   r!   r    rá  rá  J  s5   † ñô&ô
ô,
ô./ô
ô.
ô.
ô$.
÷`
r!   rá  c                  ó"   • \ rS rSrSrSS jrSrg)ÚHelpOrderTestsi  z#
Tests for the --help-orders flag.
c                ó  • U R                  [        S[        5       =n5        U R                  [        [
        R                  " 5       R                  S/5      nU R                  UR                  S5        UR                  5       nSn[
        R                  R                  5        H_  u  nu  pg[        R                  " [        R                  " U5       S[        R                  " U5       3U5      nU R!                  X„XS4-  S9  Ma     g)zC
--help-orders prints each of the available orders and then exits.
Ústdoutz--help-ordersr   z4%r with its description not properly described in %rz.*r÷  N)r^   rÁ   r   rè   rÓ  r   r(   r)   rr   ÚcoderÃ   Ú
_runOrdersÚitemsÚreÚsearchÚescaper	  )	r?   r$  r¦  Úoutputrø  Ú	orderNameÚ	orderDescÚ_Úmatchs	            r    Ú&test_help_ordersPrintsSynopsisAndQuitsÚ5HelpOrderTests.test_help_ordersPrintsSynopsisAndQuits  sÔ   € ð 	�
‰
”3˜¬H«JÐ"6 &Ô7à×ÑÜœŸš›×4Ñ4°Ð6Gó
ˆð 	×Ñ˜Ÿ™ 1Ô%à—‘Ó"ˆàDˆÜ).×)9Ñ)9×)?Ñ)?Ö)AÑ%ˆI‘~˜	Ü—I’IÜ—9’9˜YÓ'Ð(¨¬2¯9ª9°YÓ+?Ð*@ÐAØóˆEð
 �O‰O˜E¨iÐ-@Ñ'@ˆOÓAò *Br!   r%   Nrx   )rR   rS   rT   rU   rV   r0  rW   r%   r!   r    r"  r"    s   † ñ÷Br!   r"  )r   rO   rP   rO   rx   )r*   z	List[str]rP   útrial.Options)r+   r2  rP   r2  )EÚ
__future__r   r_   r9  r(  rÁ   r  r%  Úior   Útypingr   r   r   Úhamcrestr   r   Ú
hypothesisr	   Úhypothesis.strategiesr
   Útwisted.loggerr   Útwisted.pythonr   Útwisted.python.filepathr   r   Útwisted.python.usager   Útwisted.scriptsr   Útwisted.trialÚtwisted.trial._dist.disttrialr   Útwisted.trial._dist.functionalr   Útwisted.trial.runnerr   r   r   r   r   Útwisted.trial.test.test_loaderr   Úmatchersr   Ú
__import__r0   r   r&   r,   r5   r=   ÚSynchronousTestCaser7   rY   rz   r‹   r  r3  rT  ÚTestCasern  r˜  rÉ  rØ  rá  r"  r%   r!   r    Ú<module>rG     sŒ  ðõ #ã 	Û 	Û 	Û 
Û Û Ý Ý Ý ç 1Ý Ý .å !Ý ß 7Ý +Ý !Ý "Ý 9Ý 2÷õ õ 5Ý "á	�JÓ	€ô,ôôôñ ˜=¨.Ó9Ð ô=G�8×/Ñ/ô =Gô@45 (×">Ñ">ô 45ôn9�X×1Ñ1ô 9ô8I�h×2Ñ2ô IôXL8˜×5Ñ5ô L8ô^3/�H×0Ñ0ô 3/ôl0O�H×0Ñ0ô 0OôfOV�8×$Ñ$ô OVôdW+�h×'Ñ'ô W+ôtJˆx× Ñ ô Jô:/˜X×.Ñ.ô /ô:y
�×"Ñ"ô y
ôxB�X×&Ñ&õ Br!   