+
    Dfj}                     P   ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHtHtHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHtHtHtH t  ^ RI!H"t" ^ RI#H$t$H%t%  ! R R4      t&]
! ]$4       ! R R4      4       t' ! R R4      t( ! R R](]PR                  4      t* ! R R](]PR                  4      t+ ! R R4      t, ! R R],]PR                  4      t- ! R R],]PR                  4      t. ! R  R!],]PR                  4      t/ ! R" R#]PR                  4      t0 ! R$ R%]PR                  4      t1 ! R& R']PR                  4      t2 ! R( R)]24      t3 ! R* R+]Ph                  4      t5 ! R, R-]PR                  4      t6 ! R. R/]PR                  4      t7 ! R0 R14      t8 ! R2 R3]8]74      t9 ! R4 R5]8]74      t: ! R6 R7]PR                  4      t; ! R8 R9]PR                  4      t< ! R: R;]PR                  4      t= ! R< R=]PR                  4      t> ! R> R?]PR                  4      t?R# )@    N)StringIOList)implementer)verifyObject)plugin)defer)twisted_trial)failurelogreflect)FilePathnamedAny)trial)reporterrunnerunittestutil) _ForceGarbageCollectionDecorator)	IReporter	ITestCasec                   ,   a  ] tR t^t o R tR tRtV tR# )CapturingDebuggerc                    . V n         R # N_callsselfs   &@/usr/lib/python3/dist-packages/twisted/trial/test/test_runner.py__init__CapturingDebugger.__init__   s	        c                h    V P                   P                  R 4       V^ ,          ! VR,          / VB  R# )runcall:   NNNr   append)r    argskwargss   &*,r!   r&   CapturingDebugger.runcall"   s)    9%Qb$V$r$   r   N)__name__
__module____qualname____firstlineno__r"   r&   __static_attributes____classdictcell____classdict__s   @r!   r   r      s     % %r$   r   c                      a  ] tR t^'t o RtRtRtRtRtRt	RR lt
R tR tR tR tR tR	 tR
 tRR ltRR ltR tR tRtV tR# )CapturingReporterz;
Reporter that keeps a log of all actions performed on it.
Nc                R    . V n         RV n        Wn        W n        W0n        W@n        R# )z
Create a capturing reporter.
FN)r   
shouldStop_stream	_tbformat	_rterrors
_publisher)r    streamtbformatrterrors	publishers   &&&&&r!   r"   CapturingReporter.__init__3   s&     !!#r$   c                <    V P                   P                  R4       R# )zq
Report the beginning of a run of a single test method
@param method: an object that is adaptable to ITestMethod
	startTestNr(   r    methods   &&r!   rC   CapturingReporter.startTest>   s    
 	;'r$   c                <    V P                   P                  R4       R# )ze
Report the status of a single test method
@param method: an object that is adaptable to ITestMethod
stopTestNr(   rD   s   &&r!   rH   CapturingReporter.stopTestE   s    
 	:&r$   c                <    V P                   P                  R4       R# )zscalled 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!   cleanupErrorsCapturingReporter.cleanupErrorsL   s     	>*r$   c                <    V P                   P                  R 4       R# )
addSuccessNr(   r    tests   &&r!   rP   CapturingReporter.addSuccessR   s    <(r$   c                    R# )z0
Do nothing. These tests don't care about done.
N r   s   &r!   doneCapturingReporter.doneU       r$   c                    R# )z4
Do nothing. These tests don't care about addError.
NrU   r    rR   errors   &&&r!   addErrorCapturingReporter.addErrorZ   rX   r$   c                    R# )z6
Do nothing. These tests don't care about addFailure.
NrU   )r    rR   r   s   &&&r!   
addFailureCapturingReporter.addFailure_   rX   r$   c                    R# )z>
Do nothing. These tests don't care about addExpectedFailure.
NrU   )r    rR   r   todos   &&&&r!   addExpectedFailure$CapturingReporter.addExpectedFailured   rX   r$   c                    R# )z@
Do nothing. These tests don't care about addUnexpectedSuccess.
NrU   )r    rR   rb   s   &&&r!   addUnexpectedSuccess&CapturingReporter.addUnexpectedSuccessi   rX   r$   c                    R# )z3
Do nothing. These tests don't care about addSkip.
NrU   )r    rR   reasons   &&&r!   addSkipCapturingReporter.addSkipn   rX   r$   c                    R# )z9
Do nothing. These tests don't care about wasSuccessful.
NrU   r   s   &r!   wasSuccessfulCapturingReporter.wasSuccessfuls   rX   r$   )r   r<   r;   r9   r:   r8   )NNNNr   )r-   r.   r/   r0   __doc__r=   r>   r*   	separatortestsRunr"   rC   rH   rM   rP   rV   r\   r_   rc   rf   rj   rm   r1   r2   r3   s   @r!   r6   r6   '   sf      FHDIH	$('+)





 r$   r6   c                   <   a  ] tR t^yt o RtR tR tR tR tRt	V t
R# )TrialRunnerTestsMixinz1
Mixin defining tests for L{runner.TrialRunner}.
c                    R# )z-
Empty test method, used by the other tests.
NrU   r   s   &r!   
test_empty TrialRunnerTestsMixin.test_empty~   rX   r$   c                6    \         P                  P                  # r   )r   theLogPublisher	observersr   s   &r!   _getObservers#TrialRunnerTestsMixin._getObservers   s    "",,,r$   c                    \        V P                  4       4      pV P                  P                  V P                  4       \        V P                  4       4      pV P                  W!4       R# )zV
Any log system observers L{TrialRunner.run} adds are removed by the
time it returns.
N)lenrz   r   runrR   assertEqual)r    originalCountnewCounts   &  r!   test_addObservers'TrialRunnerTestsMixin.test_addObservers   sL    
 D..01		"t))+,1r$   c                v   \        V P                  P                  4      P                  V P                  P                  4      p\        ^4       Fg  pV P                  P                  V P                  4       VP                  4        V P                  VP                  4       4       VP                  4        Ki  	  R# )z-
Test that a new file is opened on each run.
N)r   r   workingDirectorychildlogfileranger~   rR   restat
assertTrueexistsremove)r    logPathis   &  r!   test_logFileAlwaysActive.TrialRunnerTestsMixin.test_logFileAlwaysActive   sx     4;;778>>t{{?R?RSqAKKOODII&NNOOGNN,- NN r$   rU   N)r-   r.   r/   r0   ro   ru   rz   r   r   r1   r2   r3   s   @r!   rs   rs   y   s#     
-2 r$   rs   c                   0   a  ] tR t^t o RtR tR tRtV tR# )TrialRunnerTestsza
Tests for L{runner.TrialRunner} with the feature to turn unclean errors
into warnings disabled.
c                    \        4       V n        \        P                  ! \        V P                  R 7      V n        \        R4      V n        R# )r=   ru   Nr   r=   r   TrialRunnerr6   r   rR   r   s   &r!   setUpTrialRunnerTests.setUp   s0    j(():4;;O$\2	r$   c                z    V P                   P                  4       pV P                  VP                  \        4       R# )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assertIdenticalr<   r   r    results   & r!   test_publisherTrialRunnerTests.test_publisher   s,    
 ((*V..4r$   r   r=   rR   N)	r-   r.   r/   r0   ro   r   r   r1   r2   r3   s   @r!   r   r      s     
3
5 5r$   r   c                   *   a  ] tR t^t o RtR tRtV tR# )+TrialRunnerWithUncleanWarningsReporterTestszU
Tests for the TrialRunner's interaction with an unclean-error suppressing
reporter.
c                    \        4       V n        \        P                  ! \        V P                  R R7      V n        \        R4      V n        R# )Tr=   uncleanWarningsru   Nr   r   s   &r!   r   1TrialRunnerWithUncleanWarningsReporterTests.setUp   s6    j((dkk4
 %\2	r$   r   Nr-   r.   r/   r0   ro   r   r1   r2   r3   s   @r!   r   r      s     
3 3r$   r   c                   B   a  ] tR t^t o RtR tR tR tR tR t	Rt
V tR# )	DryRunMixinzY
Mixin for testing that 'dry run' mode works with various
L{pyunit.TestCase} subclasses.
c                    . V n         \        4       V n        \        P                  ! \
        \        P                  P                  V P                  R 7      V n        V P                  4        R# )r   N)r   r   r=   r   r   r6   DRY_RUNmakeTestFixturesr   s   &r!   r   DryRunMixin.setUp   sI    j((v1199$++
 	r$   c                    R# )zP
Set C{self.test} and C{self.suite}, where C{self.suite} is an empty
TestSuite.
NrU   r   s   &r!   r   DryRunMixin.makeTestFixtures   rX   r$   c                    V P                   P                  \         P                  ! 4       4      pV P                  VP                  . 4       R# )zN
If there are no tests, the reporter should not receive any events to
report.
N)r   r~   	TestSuiter   r   r   s   & r!   ru   DryRunMixin.test_empty   s3    
 !1!1!34+r$   c                    V P                   P                  V P                  4      pV P                  VP                  . RO4       R# )zn
If we are running a single test, check the reporter starts, passes and
then stops the test during a dry run.
NrC   rP   rH   )r   r~   rR   r   r   r   s   & r!   test_singleCaseReporting$DryRunMixin.test_singleCaseReporting   s/    
 +(OPr$   c                    V P                   P                  V P                  4       V P                  V P                  . 4       R# )zD
When we are doing a dry run, the tests should not actually be run.
N)r   r~   rR   r   r   r   s   &r!   test_testsNotRunDryRunMixin.test_testsNotRun   s,     			"2&r$   )r   r   r=   N)r-   r.   r/   r0   ro   r   r   ru   r   r   r1   r2   r3   s   @r!   r   r      s)     
 ,Q' 'r$   r   c                   *   a  ] tR t^t o RtR tRtV tR# )SynchronousDryRunTestszK
Check that 'dry run' mode works well with trial's L{SynchronousTestCase}.
c                     ! R  R\         P                  4      pV! R4      V n        \        P                  ! 4       V n        R# )c                   &   a  ] tR t^t o R tRtV tR# );SynchronousDryRunTests.makeTestFixtures.<locals>.PyunitCasec                    R # r   rU   r   s   &r!   test_fooDSynchronousDryRunTests.makeTestFixtures.<locals>.PyunitCase.test_foo       r$   rU   Nr-   r.   r/   r0   r   r1   r2   r3   s   @r!   
PyunitCaser            r$   r   r   N)r   SynchronousTestCaserR   pyunitr   suiter    r   s   & r!   r   'SynchronousDryRunTests.makeTestFixtures   s2    	55 	 z*	%%'
r$   r   rR   Nr-   r.   r/   r0   ro   r   r1   r2   r3   s   @r!   r   r           ( (r$   r   c                   *   a  ] tR t^t o RtR tRtV tR# )DryRunTestsz8
Check that 'dry run' mode works well with Trial tests.
c                   a   ! V 3R  lR\         P                  4      pV! R4      S n        \        P                  ! 4       S n        R# )c                   .   <a  ] tR tRt o V3R ltRtV tR# ).DryRunTests.makeTestFixtures.<locals>.MockTesti  c                >   < SP                   P                  R 4       R# )r   N)r   r)   )rR   r    s   &r!   r   7DryRunTests.makeTestFixtures.<locals>.MockTest.test_foo  s    
+r$   rU   Nr   )r4   r    s   @r!   MockTestr     s     , ,r$   r   r   N)r   TestCaserR   r   r   r   )r    r   s   f r!   r   DryRunTests.makeTestFixtures  s3    	,x(( 	, Z(	%%'
r$   r   Nr   r3   s   @r!   r   r      r   r$   r   c                   *   a  ] tR tRt o RtR tRtV tR# )PyUnitDryRunTestsi  zB
Check that 'dry run' mode works well with stdlib unittest tests.
c                     ! R  R\         P                  4      pV! R4      V n        \         P                  ! 4       V n        R# )c                   &   a  ] tR tRt o R tRtV tR# )6PyUnitDryRunTests.makeTestFixtures.<locals>.PyunitCasei  c                    R # r   rU   r   s   &r!   r   ?PyUnitDryRunTests.makeTestFixtures.<locals>.PyunitCase.test_foo  r   r$   rU   Nr   r3   s   @r!   r   r     r   r$   r   r   N)r   r   rR   r   r   r   s   & r!   r   "PyUnitDryRunTests.makeTestFixtures  s0    	 	 z*	%%'
r$   r   Nr   r3   s   @r!   r   r     r   r$   r   c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR t]! 4       tR tR tRtV tR# )RunnerTestsi  c           	     r  a a \         P                  ! 4       S n        \        P                  ! \
        4      P                  R 4      pR P                  VRR 4      pVR,          p\        P                  ! RVRRRVR7      .oVV 3R lp\        P                  S n        V\        n        . RO^
,          S n        R# )	.NzTest Helper ReporterzUtility for unit testing.	capturing)descriptionlongOptshortOptklassc                 |   < SP                  V \        4       S\        SP                  ! V .VO5/ VB 4      ,           # r   )r   r   listoriginal)ifaceakwpluginsr    s   &*,r!   
getPlugins%RunnerTests.setUp.<locals>.getPlugins/  s6    UI.T$--"@"@R"@AAAr$   r   )r   Optionsconfigr   qualr6   splitjoinr
   	_Reporterr   r   r   standardReport)r    partspackager   r   r   s   f    @r!   r   RunnerTests.setUp  s    mmo ./55c:((5":&b	##&7#	
	B ))&
 FJr$   c                0    V P                   \        n        R # r   )r   r   r   r   s   &r!   tearDownRunnerTests.tearDown;  s     MMr$   c                <    V P                   P                  V4       R # r   )r   parseOptionsr    r*   s   &&r!   r  RunnerTests.parseOptions>  s      &r$   c                d    \         P                  ! V P                  4      p\        4       Vn        V# r   )r   _makeRunnerr   r   r=   )r    rs   & r!   	getRunnerRunnerTests.getRunnerA  s$    dkk*:r$   c                    V P                  . 4       V P                  R ,          pV P                  4       pV P                  WP                  ! 4       P
                  4       R# r   N)r  r   r  r   r   	__class__)r    r   r   s   &  r!   test_runner_can_get_reporter(RunnerTests.test_runner_can_get_reporterF  sG    "Z(!!3!3!5!?!?@r$   c                    V P                  . 4       V P                  4       pVP                  ! 4       pV P                  VP                  V P
                  R ,          4       R# r
  )r  r  r   r   r  r   r    r   r   s   &  r!   test_runner_get_result"RunnerTests.test_runner_get_resultL  sI    "!##%))4;;z+BCr$   c                    V P                  . 4       V P                  4       pV P                  VP                  ! 4       \        P
                  4       R# )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r    r   s   & r!    test_uncleanWarningsOffByDefault,RunnerTests.test_uncleanWarningsOffByDefaultR  s@     	"!   ("I"I	
r$   c                    V P                  R.4       V P                  4       pV P                  VP                  ! 4       \        P
                  4       R# )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   r   r  r  s   & r!   test_getsUncleanWarnings$RunnerTests.test_getsUncleanWarnings^  sD     	/01! ("I"I	
r$   c                    V P                  R R.4       V P                  4       pV P                  VP                  R4       R# )--temp-directory	some_pathN)r  r  r   r   r  s   & r!   test_runner_working_directory)RunnerTests.test_runner_working_directoryj  s8    -{;<!00+>r$   c           	       aaaa V P                  . 4       V P                  \        P                  \        P                  ! 4       4       \        V P                  4       4      oSP                  4        \        P                  ! SP                  4       V P                  4       pV P                  4       o/ o ! VVVV3R lR\        P                  4      oVP                  S! R4      4      pVP                  VP                  ,           pV'       d    V P                  V^ ,          ^,          4       V P!                  SRSP#                  R4      P                  RSP#                  R4      P                  /4       R# )	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                   @   <a  ] tR tRt o VVVV3R ltV3R ltRtV tR# )KRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCasei  c                   < \         P                  ! 4       ;SR&   p\         P                  ! SP                  4       V P	                  \         P                  V4       SP                  S! R4      4       R# )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
addCleanupr~   )r    subsequentDirectoryConcurrentCaserunDirectorysecondRunnerwheres   & r!   
test_firstVRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCase.test_first  sS     =?IIKGl#&9**+*=>  !>?r$   c                8   < \         P                  ! 4       SR&   R# )z2
Record the working directory for later analysis.
recordN)r'  r(  )r    r0  s   &r!   r&  WRunnerTests.test_concurrentImplicitWorkingDirectory.<locals>.ConcurrentCase.test_second  s     #%))+hr$   rU   N)r-   r.   r/   r0   r1  r&  r1   r2   )r4   r-  r.  r/  r0  s   @r!   r-  r#    s     @ @. .r$   r-  r1  r%  _trial_tempr4  z_trial_temp-1N)r  r+  r'  r)  r(  r   mktempmakedirsr*  r  r   r   r~   errorsfailuresfailr   r   )r    firstRunnerr   badr-  r.  r/  r0  s   &   @@@@r!   'test_concurrentImplicitWorkingDirectory3RunnerTests.test_concurrentImplicitWorkingDirectoryo  s    	" 	"))+.
  .
""#nn&~~'	. 	.X99 	.* !=>mmfoo-IIc!fQi l00?DD,,,_=BB	
r$   c                $  aa V P                  R\        P                  P                  V P	                  4       4      .4       \        P
                  ! 4       pV P                  \        P                  V4       V P                  4       pV P                  4       o ! VV3R lR\        P                  4      oVP                  S! R4      4      pVP                  VP                  ,           pV'       d"   V P                  V^ ,          ^,          4       R# R# )z}
If a working directory which is already in use is explicitly specified,
L{TrialRunner.run} raises L{_WorkingDirectoryBusy}.
r  c                   6   <a  ] tR tRt o VV3R ltR tRtV tR# )KRunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCasei  c                j   < V P                  \        P                  SP                  S! R4      4       R# )zo
Try to start another runner in the same working directory and
assert that it raises L{_WorkingDirectoryBusy}.
test_failureN)assertRaisesr   _WorkingDirectoryBusyr~   )r    r-  r/  s   &r!   test_concurrent[RunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCase.test_concurrent  s-    
 !!.. $$">2r$   c                (    V P                  R4       R# )z%
Should not be called, always fails.
z$test_failure should never be called.N)r;  r   s   &r!   rD  XRunnerTests.test_concurrentExplicitWorkingDirectory.<locals>.ConcurrentCase.test_failure  s     		@Ar$   rU   N)r-   r.   r/   r0   rG  rD  r1   r2   )r4   r-  r/  s   @r!   r-  rB    s     	B Br$   r-  rG  N)r  r'  r*  abspathr7  r(  r+  r)  r  r   r   r~   r9  r:  r;  )r    initialDirectoryr<  r   r=  r-  r/  s   &    @@r!   'test_concurrentExplicitWorkingDirectory3RunnerTests.test_concurrentExplicitWorkingDirectory  s    
 	-rwwt{{}/MNO99;"23nn&~~'	B 	BX99 	B$ 0A!BCmmfoo-IIc!fQi  r$   c                *   V P                  R V P                  4       RRR.4       V P                  4       p\        P                  ! 4       pVP                  RR4      pVP                  V4      pV P                  V P                  VP                  4       R# )r  
--reporterr   twisted.trial.test.sampleTN)
r  r7  r  r   
TestLoader
loadByNamer~   r   r   r   )r    	my_runnerloaderr   r   s   &    r!   test_runner_normalRunnerTests.test_runner_normal  s    "+	
 NN$	""$!!"=tDu%,,fmm<r$   c                r    \         P                  ! 4       pVP                  R R4      pVP                  V4      # )rQ  T)r   rR  rS  r~   )r    rT  rU  r   s   &&  r!   runSampleSuiteRunnerTests.runSampleSuite  s2    ""$!!"=tD}}U##r$   c                   V P                  . RO4       V P                  4       p\        4       ;q!n        V P	                  V4      pV P                  V P                  VP                  4       V P                  R.VP                  4       R# )z<
Trial uses its debugger if the `--debug` option is passed.
r&   N)rP  r   --debugrQ  )r  r  r   debuggerrY  r   r   r   )r    rT  r]  r   s   &   r!   test_runnerDebugRunnerTests.test_runnerDebug  sq     	O	
 NN$	(9(;;%$$Y/,,fmm<)hoo6r$   c                4  a  S P                  RR.4       \        R4      pVP                  4        RS n        V 3R lpS P	                  \
        P                  RV4       S P                  S P                  4       4       S P                  S P                  4       R# )z<
Trial uses pdb if no debugger is specified by `--debugger`
r\  rQ  pdbrcFc                    < R Sn         R# TNruncall_calledpdbr   r   r    s   &&&r!   r&   =RunnerTests.test_runnerDebuggerDefaultsToPdb.<locals>.runcall      "&Dr$   r&   N)
r  r   touchre  patchrg  PdbrY  r  r   )r    	pdbrcFiler&   s   f  r!    test_runnerDebuggerDefaultsToPdb,RunnerTests.test_runnerDebuggerDefaultsToPdb  sw     	9&ABCW%	#	' 	

377Iw/DNN,-++,r$   c                   a  S P                  . RO4       RS n        V 3R lpS P                  \        P                  RV4       S P                  S P                  4       4       S P                  S P                  4       R# )zE
Trial uses pdb if pdb is passed explicitly to the `--debugger` arg.
Fc                    < R Sn         R# rc  rd  rf  s   &&&r!   r&   GRunnerTests.test_runnerDebuggerWithExplicitlyPassedPdb.<locals>.runcall  ri  r$   r&   N)rP  r   
--debuggerrg  r\  rQ  )r  re  rk  rg  rl  rY  r  r   )r    r&   s   f r!   *test_runnerDebuggerWithExplicitlyPassedPdb6RunnerTests.test_runnerDebuggerWithExplicitlyPassedPdb  sd     			
 $	' 	

377Iw/DNN,-++,r$   c                   V P                  . RO4       V P                  4       pV P                  V4      pV P                  V P                  VP
                  4       V P                  R.VP                  P
                  4       R# )z=
Trial uses specified debugger if the debugger is available.
r&   N)rP  r   rs  z4twisted.trial.test.test_runner.RunnerTests.cdebuggerr\  rQ  )r  r  rY  r   r   r   r]  )r    rT  r   s   &  r!   test_runnerDebuggerRunnerTests.test_runnerDebugger  sm     			
 NN$	$$Y/,,fmm<)i&8&8&?&?@r$   c                    V P                  R.4       V P                  4       pVP                  ! 4       pV P                  V\        P
                  4       R# )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_exitfirstRunnerTests.test_exitfirst0  sD    
 	=/*!##%fh&;&;<r$   )r   r   re  r   N)r-   r.   r/   r0   r   r   r  r  r  r  r  r  r  r>  rM  rV  rY  r^  rn  rt  r   	cdebuggerrw  r{  r1   r2   r3   s   @r!   r   r     su     KB*'
AD



?
7
r"!H= $
7-&-4 "#IA&= =r$   r   c                   &   a  ] tR tRt o R tRtV tR# )TrialSuiteTestsi;  c                    \        R 4       R# )ztwisted.trial.runner.TrialSuiteNr   r   s   &r!   test_importsTrialSuiteTests.test_imports<  s    23r$   rU   N)r-   r.   r/   r0   r  r1   r2   r3   s   @r!   r  r  ;  s     4 4r$   r  c                   h   a  ] tR tRt o  ! R R]P
                  4      tR tR tR t	R t
R tR	tV tR
# )UntilFailureTestsiA  c                   :   a  ] tR tRt o Rt. tR tV 3R ltRtV t	R# )UntilFailureTests.FailAfteriB  z3
A test case that fails when run 3 times in a row.
c                    V P                   P                  R 4       \        V P                   4      ^8X  d   V P                  R4       R # R # )NzCount reached 3)countr)   r}   r;  r   s   &r!   r   $UntilFailureTests.FailAfter.test_fooI  s6    JJd#4::!#		+, $r$   c                4   < V ^8  d   Qh/ S[ R,          ;R&   # )   Nr  r   )formatr4   s   "r!   __annotate__(UntilFailureTests.FailAfter.__annotate__B  s     
 Dz r$   rU   N)
r-   r.   r/   r0   ro   r  r   __annotate_func__r1   r2   r3   s   @r!   	FailAfterr  B  s     	 	-  r$   r  c                    . \         P                  n        \         P                  R 4      V n        \	        4       V n        \        P                  ! \        P                  V P
                  R7      V n        R# )r   r   N)
r  r  r  rR   r   r=   r   r   r   Reporterr   s   &r!   r   UntilFailureTests.setUpN  sJ    ,.##)%//
;	j(():):4;;Or$   c                   V P                   P                  V P                  4      pV P                  VP                  ^4       V P                  VP                  4       4       V P                  V P                  V4      ^4       R# )zT
Test that the runUntilFailure method of the runner actually fail after
a few runs.
N)r   runUntilFailurerR   r   rq   assertFalserm   _getFailuresr   s   & r!   test_runUntilFailure&UntilFailureTests.test_runUntilFailureT  sb    
 ,,TYY7!,--/0**62A6r$   c                ,    \        VP                  4      # )z<
Get the number of failures that were reported to a result.
)r}   r:  r   s   &&r!   r  UntilFailureTests._getFailures^  s     6??##r$   c                D  a . oV3R lpV P                  \        RV4       V P                  P                  V P                  4      pV P                  VP                  ^4       V P                  \        S4      ^4       V P                  SV P                  \        3.4       R# )zu
C{runUntilFailure} doesn't decorate the tests uselessly: it does it one
time when run starts, but not at each turn.
c                 ,   < SP                  W34       V # r   r)   rR   	interface	decorateds   &&r!   decorate@UntilFailureTests.test_runUntilFailureDecorate.<locals>.decoratek      d./Kr$   r  N)	rk  r   r   r  rR   r   rq   r}   r   r    r  r   r  s   &  @r!   test_runUntilFailureDecorate.UntilFailureTests.test_runUntilFailureDecorated  s}    
 		 	

8Z2,,TYY7!,Y+dii%;$<=r$   c                  a . oV3R lpV P                  \        RV4       RV P                  n        V P                  P	                  V P
                  4      pV P                  VP                  ^4       V P                  \        S4      ^4       V P                  SV P
                  \        3V P
                  \        3.4       R# )zs
C{runUntilFailure} applies the force-gc decoration after the standard
L{ITestCase} decoration, but only one time.
c                 ,   < SP                  W34       V # r   r  r  s   &&r!   r  GUntilFailureTests.test_runUntilFailureForceGCDecorate.<locals>.decorate}  r  r$   r  TN)rk  r   r   _forceGarbageCollectionr  rR   r   rq   r}   r   r   r  s   &  @r!   #test_runUntilFailureForceGCDecorate5UntilFailureTests.test_runUntilFailureForceGCDecoratev  s    
 		 	

8Z2.2+,,TYY7!,Y+ii#dii1Q%RS	
r$   r   N)r-   r.   r/   r0   r   r   r  r   r  r  r  r  r1   r2   r3   s   @r!   r  r  A  s4     
-FOO 
-P7$>$
 
r$   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )UncleanUntilFailureTestsi  z\
Test that the run-until-failure feature works correctly with the unclean
error suppressor.
c                    \         P                  V 4       \        P                  ! \        P
                  V P                  R R7      V n        R# )Tr   N)r  r   r   r   r   r  r=   r   s   &r!   r   UncleanUntilFailureTests.setUp  s3    %((dkk4
r$   c                @    \        VP                  P                  4      # )zh
Get the number of failures that were reported to a result that
is wrapped in an UncleanFailureWrapper.
)r}   _originalReporterr:  r   s   &&r!   r  %UncleanUntilFailureTests._getFailures  s    
 6++4455r$   )r   N)	r-   r.   r/   r0   ro   r   r  r1   r2   r3   s   @r!   r  r    s     

6 6r$   r  c                   *   a  ] tR tRt o RtR tRtV tR# )BreakingSuitei  z3
A L{TestSuite} that logs an error when it is run.
c                     \        R 4      h  \          d.    \        P                  ! \        P                  ! 4       4        R# i ; i)z#error that occurs outside of a testN)RuntimeErrorr   errr   Failurer   s   &&r!   r~   BreakingSuite.run  s5    	'DEE 	'GGGOO%&	's    4AArU   N)r-   r.   r/   r0   ro   r~   r1   r2   r3   s   @r!   r  r    s     ' 'r$   r  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )LoggedErrorsTestsi  z
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                0    V P                  \        4       R # r   )flushLoggedErrorsr  r   s   &r!   r   LoggedErrorsTests.tearDown  s    |,r$   c                p    \         P                  ! 4       pV P                  VP                  4       ^ 4       R# )zO
Check that we can construct a L{runner.LoggedSuite} and that it
starts empty.
N)r   LoggedSuiter   countTestCases)r    r   s   & r!   test_construct LoggedErrorsTests.test_construct  s+    
 ""$--/3r$   c                   \         P                  ! 4       p\        P                  ! \	        4       .4      pVP                  V4       V P                  \        VP                  4      ^4       V P                  VP                  ^ ,          ^ ,          P                  4       \        P                  4       V P                  VP                  ^ ,          ^,          P                  \        4      4       R# )zE
Chek that a L{LoggedSuite} reports any logged errors to its result.
N)r   
TestResultr   r  r  r~   r   r}   r9  idNOT_IN_TESTr   checkr  )r    r   r   s   &  r!   test_capturesError$LoggedErrorsTests.test_capturesError  s     $$&""MO#45		&V]]+Q/q)!,//163E3EFa(+11,?@r$   rU   N)
r-   r.   r/   r0   ro   r   r  r  r1   r2   r3   s   @r!   r  r    s      -4	A 	Ar$   r  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )TestHolderTestsi  c                ^    R V n         \        P                  ! V P                   4      V n        R# r   N)r   r   
TestHolderholderr   s   &r!   r   TestHolderTests.setUp  s"    (''(8(89r$   c                    V P                  V P                  P                  4       V P                  4       V P                  V P                  P	                  4       V P                  4       R# )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)r   r  r  r   shortDescriptionr   s   &r!   test_holderTestHolderTests.test_holder  sH     	)4+;+;<5579I9IJr$   c                    V P                  V P                  \        V P                  4      4       V P                  \	        \        V P                  4      V P                  : R\        : R24       R# )z/
L{runner.TestHolder} implements L{ITestCase}.
z claims to provide z but does not do so correctly.N)r   r  r   r   r   r   s   &r!   test_holderImplementsITestCase.TestHolderTests.test_holderImplementsITestCase  sI     	T[[)DKK*@ADKK0{{I'	
r$   c                    \         P                  ! 4       pV P                  P                  V4       V P	                  VP                  4       4       V P                  ^VP                  4       R# )zK
A L{runner.TestHolder} can run against the standard Python
C{TestResult}.
N)r   r  r  r~   r   rm   r   rq   r   s   & r!   test_runsWithStandardResult+TestHolderTests.test_runsWithStandardResult  sK    
 ""$,,./FOO,r$   )r   r  N)
r-   r.   r/   r0   r   r  r  r  r1   r2   r3   s   @r!   r  r    s     :K	
- -r$   r  c                   f   a  ] tR tRt o Rt]! R4      t ! R R4      tR tR t	R t
R	 tR
 tRtV tR# )ErrorHolderTestsMixini  aE  
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                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	$ErrorHolderTestsMixin.TestResultStubi  z
Stub for L{TestResult}.
c                    . V n         R # r   r9  r   s   &r!   r"   -ErrorHolderTestsMixin.TestResultStub.__init__  s	    DKr$   c                    R # r   rU   rQ   s   &&r!   rC   .ErrorHolderTestsMixin.TestResultStub.startTest      r$   c                    R # r   rU   rQ   s   &&r!   rH   -ErrorHolderTestsMixin.TestResultStub.stopTest  r  r$   c                >    V P                   P                  W34       R # r   )r9  r)   rZ   s   &&&r!   r\   -ErrorHolderTestsMixin.TestResultStub.addError  s    KK}-r$   r  N)r-   r.   r/   r0   ro   r"   rC   rH   r\   r1   r2   r3   s   @r!   TestResultStubr    s#     					. 	.r$   r  c                    \         P                  ! 4       pV P                  P                  V4       V P	                  VP                  4       4       V P                  ^VP                  4       R# )zL
A L{runner.ErrorHolder} can run against the standard Python
C{TestResult}.
N)r   r  r  r~   r  rm   r   rq   r   s   & r!   r  1ErrorHolderTestsMixin.test_runsWithStandardResult  sM    
 ""$--/0FOO,r$   c                4   V P                   P                  V P                  4       V P                  V P                  P                  V P                   V P
                  P                  V P
                  P                  V P
                  P                  33.4       R# )z=
L{runner.ErrorHolder} adds an error to the result when run.
N)	r  r~   r   r   r9  r[   typevaluetbr   s   &r!   test_runErrorHolderTestsMixin.test_run  sc     	$KKkkDJJOOTZZ-=-=tzz}}MNO	
r$   c                    V P                  V P                  4       V P                  V P                  P                  V P                   V P                  P
                  V P                  P                  V P                  P                  33.4       R# )z@
L{runner.ErrorHolder} adds an error to the result when called.
N)r  r   r   r9  r[   r  r  r  r   s   &r!   	test_callErrorHolderTestsMixin.test_call"  s_     	DKK KKkkDJJOOTZZ-=-=tzz}}MNO	
r$   c                Z    V P                  V P                  P                  4       ^ 4       R# )z8
L{runner.ErrorHolder.countTestCases} always returns 0.
N)r   r  r  r   s   &r!   test_countTestCases)ErrorHolderTestsMixin.test_countTestCases,  s!     	335q9r$   c                    RP                  \        V P                  P                  ^,          4      4      pV P	                  \        V P                  4      V4       R# )zP
L{runner.ErrorHolder.__repr__} returns a string describing the error it
holds.
z0<ErrorHolder description='description' error={}>N)r  reprr  r[   r   )r    expecteds   & r!   	test_reprErrorHolderTestsMixin.test_repr2  sG    
 IOO""1%&
 	dkk*H5r$   rU   N)r-   r.   r/   r0   ro   ZeroDivisionErrorexceptionForTestsr  r  r  r  r  r  r1   r2   r3   s   @r!   r  r    s@      **NO. ."-

:	6 	6r$   r  c                   *   a  ] tR tRt o RtR tRtV tR# )FailureHoldingErrorHolderTestsi>  z
Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder}
when constructed with a L{Failure} representing its error.
c                   R V n          V P                  h  \         d    \        P                  ! 4       T n         Mi ; i\        P                  ! T P                   T P
                  4      T n        T P                  4       T n
        R# r  )r   r  r   r   r  r[   r   ErrorHolderr  r  r   r   s   &r!   r   $FailureHoldingErrorHolderTests.setUpD  sf    (	+(((  	+ *DJ	+(()9)94::F))+s    %==r   r[   r  r   Nr   r3   s   @r!   r  r  >  s     
, ,r$   r  c                   *   a  ] tR tRt o RtR tRtV tR# )ExcInfoHoldingErrorHolderTestsiO  z
Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder}
when constructed with a C{exc_info}-style tuple representing its error.
c                $   R V n          V P                  h  \         d3    \        P                  ! 4       p\
        P                  ! 4       T n         Mi ; i\        P                  ! T P                   T4      T n
        T P                  4       T n        R# r  )r   r  r   sysexc_infor   r  r[   r   r  r  r  r   )r    exceptionInfos   & r!   r   $ExcInfoHoldingErrorHolderTests.setUpU  so    (	+(((  	+LLNM *DJ	+ (()9)9=I))+s    :AAr  Nr   r3   s   @r!   r	  r	  O  s     
	, 	,r$   r	  c                   f   a  ] tR tRt o Rt ! R R]P                  4      tR tR t	R t
R tR	tV tR
# )MalformedMethodTestsia  zJ
Test that trial manages when test methods don't have correct signatures.
c                   T   a  ] tR tRt o RtR tR t]P                  ! ]4      t	Rt
V tR# )%MalformedMethodTests.ContainMalformedif  zF
This TestCase holds malformed test methods that trial should handle.
c                    R # r   rU   )r    blahs   &&r!   r   .MalformedMethodTests.ContainMalformed.test_fook  r  r$   c                     R # r   rU   rU   r$   r!   test_bar.MalformedMethodTests.ContainMalformed.test_barn  r  r$   rU   N)r-   r.   r/   r0   ro   r   r  r	   inlineCallbacks	test_spamr1   r2   r3   s   @r!   ContainMalformedr  f  s&     			 ))(3	r$   r  c                r   \        4       p\        P                  ! \        P                  VR7      p\
        P                  V4      pVP                  V4      pV P                  VP                  ^4       V P                  VP                  4       4       V P                  \        VP                  4      ^4       R# )z<
Wrapper for one of the test method of L{ContainMalformed}.
r   N)r   r   r   r   r  r  r  r~   r   rq   r  rm   r}   r9  )r    rE   r=   trialRunnerrR   r   s   &&    r!   _testMalformedMethodTests._tests  s     (():):6J#44V<&!,--/0V]]+Q/r$   c                (    V P                  R4       R# )z5
Test when the method has extra (useless) arguments.
r   Nr  r   s   &r!   test_extraArg"MalformedMethodTests.test_extraArg       	

:r$   c                (    V P                  R4       R# )z:
Test when the method doesn't have even self as argument.
r  Nr!  r   s   &r!   
test_noArgMalformedMethodTests.test_noArg  r$  r$   c                (    V P                  R4       R# )z%
Test a decorated method also fails.
r  Nr!  r   s   &r!   test_decorated#MalformedMethodTests.test_decorated  s     	

;r$   rU   N)r-   r.   r/   r0   ro   r   r   r  r  r"  r&  r)  r1   r2   r3   s   @r!   r  r  a  s3     46?? 4
0   r$   r  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )DestructiveTestSuiteTestsi  z*
Test for L{runner.DestructiveTestSuite}.
c                X  a . o ! V3R lR\         P                  4      pV! R4      p\        P                  ! 4       p\        P
                  ! V.4      pV P                  S. 4       VP                  V4       V P                  SR.4       V P                  VP                  4       ^ 4       R# )z<
Thes destructive test suite should run the tests normally.
c                   .   <a  ] tR tRt o V3R ltRtV tR# )6DestructiveTestSuiteTests.test_basic.<locals>.MockTesti  c                *   < SP                  R 4       R# rc  r  rR   calleds   &r!   r   ?DestructiveTestSuiteTests.test_basic.<locals>.MockTest.test_foo  s    d#r$   rU   Nr   r4   r2  s   @r!   r   r/    s     $ $r$   r   r   TN)	r   r   r   r  r   DestructiveTestSuiter   r~   r  )r    r   rR   r   r   r2  s   &    @r!   
test_basic$DestructiveTestSuiteTests.test_basic  s     	$v 	$ 
#$$&++TF3$		&$(--/3r$   c                  a . o ! V3R lR\         P                  4      p\        P                  ! 4       p\        P
                  ! 4       p\        P                  Vn        VP                  V4      pV P                  S. 4       VP                  V4       V P                  S^.4       V P                  VP                  4       ^4       R# )z]
Test the C{shouldStop} management: raising a C{KeyboardInterrupt} must
interrupt the suite.
c                   @   <a  ] tR tRt o V3R ltR tV3R ltRtV tR# );DestructiveTestSuiteTests.test_shouldStop.<locals>.MockTesti  c                *   < SP                  ^4       R# )r'   Nr  r1  s   &r!   	test_foo1EDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo1      a r$   c                    \        4       hr   )KeyboardInterruptrR   s   &r!   	test_foo2EDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo2  s    '))r$   c                *   < SP                  ^4       R# )r  Nr  r1  s   &r!   	test_foo3EDestructiveTestSuiteTests.test_shouldStop.<locals>.MockTest.test_foo3  r>  r$   rU   N)	r-   r.   r/   r0   r<  rB  rE  r1   r2   r4  s   @r!   r   r:    s     !*! !r$   r   N)r   r   r   r  r   rR  r5  suiteFactory	loadClassr   r~   r  )r    r   r   rU  r   r2  s   &    @r!   test_shouldStop)DestructiveTestSuiteTests.test_shouldStop  s    
 	!x(( 	! $$&""$$99  *$		&!%--/3r$   c                B    ! R R\         P                  4      pV! R4      p\        P                  ! 4       p\        P
                  ! V.4      pV P                  VP                  4       ^4       VP                  V4       V P                  VP                  4       ^ 4       R# )zV
Checks that the test suite cleanups its tests during the run, so that
it ends empty.
c                   &   a  ] tR tRt o R tRtV tR# )8DestructiveTestSuiteTests.test_cleanup.<locals>.MockTesti  c                    R # r   rU   rA  s   &r!   r   ADestructiveTestSuiteTests.test_cleanup.<locals>.MockTest.test_foo  r   r$   rU   Nr   r3   s   @r!   r   rM    r   r$   r   r   N)	r   r   r   r  r   r5  r   r  r~   )r    r   rR   r   r   s   &    r!   test_cleanup&DestructiveTestSuiteTests.test_cleanup  s|    	v 	 
#$$&++TF3--/3		&--/3r$   rU   N)
r-   r.   r/   r0   ro   r6  rI  rP  r1   r2   r3   s   @r!   r,  r,    s     4$464 4r$   r,  c                   @    ] tR tRt ! R R]P
                  4      tRtR# )RunnerDeprecationTestsi  c                   H   a  ] tR tRt o RtRtRtRtR tR t	R t
R tRtV tR# )	#RunnerDeprecationTests.FakeReporteri  z
Fake reporter that does *not* implement done() but *does* implement
printErrors, separator, printSummary, stream, write and writeln
without deprecations.
Nc                    R # r   rU   r  s   &*r!   printErrors/RunnerDeprecationTests.FakeReporter.printErrors  r  r$   c                    R # r   rU   r  s   &*r!   printSummary0RunnerDeprecationTests.FakeReporter.printSummary  r  r$   c                    R # r   rU   r  s   &*r!   write)RunnerDeprecationTests.FakeReporter.write  r  r$   c                    R # r   rU   r  s   &*r!   writeln+RunnerDeprecationTests.FakeReporter.writeln  r  r$   rU   )r-   r.   r/   r0   ro   rV   rp   r=   rW  rZ  r]  r`  r1   r2   r3   s   @r!   FakeReporterrU    s4     	 					 	r$   rb  rU   N)r-   r.   r/   r0   r   r  rb  r1   rU   r$   r!   rS  rS    s    x((  r$   rS  c                   *   a  ] tR tRt o RtR tRtV tR# )QualifiedNameWalkerTestsi  z4
Tests for L{twisted.trial.runner._qualNameWalker}.
c                    \        \        P                  ! R4      4      pV P                  VR. 3RR.3RRR.3.4       R# )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.
zwalker.texas.rangerzwalker.texasrangerwalkertexasN)r   r   _qualNameWalkerr   )r    walkerResultss   & r!   test_walksDownPath+QualifiedNameWalkerTests.test_walksDownPath  sO     V334IJK&+(,GX./	
r$   rU   N)r-   r.   r/   r0   ro   rk  r1   r2   r3   s   @r!   rd  rd    s     
 
r$   rd  c                   *   a  ] tR tRt o RtR tRtV tR# )TrialMainDoesNothingTestsi  z`
Importing L{twisted.trial.__main__} will not run the script
unless it is actually C{__main__}.
c                    \        R4       R# )z?
If we import L{twisted.trial.__main__}, it should do nothing.
ztwisted.trial.__main__N)
__import__r   s   &r!   test_importDoesNothing0TrialMainDoesNothingTests.test_importDoesNothing  s    
 	+,r$   rU   N)r-   r.   r/   r0   ro   rq  r1   r2   r3   s   @r!   rn  rn    s     
- -r$   rn  )@r'  rg  r  r   r   ior   typingr   zope.interfacer   zope.interface.verifyr   twistedr   twisted.internetr	   twisted.pluginsr
   twisted.pythonr   r   r   twisted.python.filepathr   twisted.python.reflectr   twisted.scriptsr   twisted.trialr   r   r   twisted.trial._asyncrunnerr   twisted.trial.itrialr   r   r   r6   rs   r   r   r   r   r   r   r   r   r  r  r  r   r  r  r  r  r  r	  r  r,  rS  rd  rn  rU   r$   r!   <module>r     s   
 
 
    & .  " ) 0 0 , + ! : : G 5% % YN N Nb# #L5,h.J.J 5(38773 )' )'X([(*F*F ((+x;; ((X%A%A (_=(.. _=D	4h22 4I
44 I
X60 6(	'F$$ 	'A44 A>!-h22 !-HK6 K6\,%:O ,",%:O ,$. 877 . bA4 < < A4HX99 2
x;; 
.- < < -r$   