Ϫf}NddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lmZmZmZm Z ddl!m"Z"ddl#m$Z$m%Z%GddZ&e e$GddZ'GddZ(Gdde(ejRZ*Gdde(ejRZ+GddZ,Gdde,ejRZ-Gdde,ejRZ.Gd d!e,ejRZ/Gd"d#ejRZ0Gd$d%ejRZ1Gd&d'ejRZ2Gd(d)e2Z3Gd*d+ejhZ5Gd,d-ejRZ6Gd.d/ejRZ7Gd0d1Z8Gd2d3e8e7Z9Gd4d5e8e7Z:Gd6d7ejRZ;Gd8d9ejRZ<Gd:d;ejRZ=Gd<d=ejRZ>Gd>d?ejRZ?y)@N)StringIO)List) implementer) verifyObject)plugin)defer) twisted_trial)failurelogreflect)FilePathnamedAny)trial)reporterrunnerunittestutil) _ForceGarbageCollectionDecorator) IReporter ITestCaseceZdZdZdZy)CapturingDebuggercg|_yN)_callsselfs @/usr/lib/python3/dist-packages/twisted/trial/test/test_runner.py__init__zCapturingDebugger.__init__s  cV|jjd|d|ddi|y)Nruncallrrappend)rargskwargss rr#zCapturingDebugger.runcall"s- 9%Qab$V$r!N)__name__ __module__ __qualname__r r#r!rrrs %r!rcreZdZdZdZdZdZdZdZddZ dZ dZ dZ dZ dZd Zd Zdd Zdd Zd ZdZy)CapturingReporterzC Reporter that keeps a log of all actions performed on it. NcXg|_d|_||_||_||_||_y)z. Create a capturing reporter. FN)r shouldStop_stream _tbformat _rterrors _publisher)rstreamtbformatrterrors publishers rr zCapturingReporter.__init__3s.  !!#r!c:|jjdy)z Report the beginning of a run of a single test method @param method: an object that is adaptable to ITestMethod startTestNr%rmethods rr:zCapturingReporter.startTest>s ;'r!c:|jjdy)z} Report the status of a single test method @param method: an object that is adaptable to ITestMethod stopTestNr%r;s rr>zCapturingReporter.stopTestEs :&r!c:|jjdy)zcalled when the reactor has been left in a 'dirty' state @param errs: a list of L{twisted.python.failure.Failure}s cleanupErrorNr%)rerrss r cleanupErrorszCapturingReporter.cleanupErrorsLs >*r!c:|jjdy)N addSuccessr%rtests rrDzCapturingReporter.addSuccessRs <(r!cy)z@ Do nothing. These tests don't care about done. Nr,rs rdonezCapturingReporter.doneUr!cy)zD Do nothing. These tests don't care about addError. Nr,rrFerrors raddErrorzCapturingReporter.addErrorZrIr!cy)zF Do nothing. These tests don't care about addFailure. Nr,)rrFr s r addFailurezCapturingReporter.addFailure_rIr!cy)zN Do nothing. These tests don't care about addExpectedFailure. Nr,)rrFr todos raddExpectedFailurez$CapturingReporter.addExpectedFailuredrIr!cy)zP Do nothing. These tests don't care about addUnexpectedSuccess. Nr,)rrFrQs raddUnexpectedSuccessz&CapturingReporter.addUnexpectedSuccessirIr!cy)zC Do nothing. These tests don't care about addSkip. Nr,)rrFreasons raddSkipzCapturingReporter.addSkipnrIr!cy)zI Do nothing. These tests don't care about wasSuccessful. Nr,rs r wasSuccessfulzCapturingReporter.wasSuccessfulsrIr!)NNNNr)r)r*r+__doc__r5r6r' separatortestsRunr r:r>rBrDrHrMrOrRrTrWrYr,r!rr.r.'s^FH DIH $('+ )       r!r.c(eZdZdZdZdZdZdZy)TrialRunnerTestsMixinz9 Mixin defining tests for L{runner.TrialRunner}. cy)z= Empty test method, used by the other tests. Nr,rs r test_emptyz TrialRunnerTestsMixin.test_empty~rIr!c6tjjSr)r theLogPublisher observersrs r _getObserversz#TrialRunnerTestsMixin._getObserverss"",,,r!ct|j}|jj|jt|j}|j ||y)zn Any log system observers L{TrialRunner.run} adds are removed by the time it returns. N)lenrdrrunrF assertEqual)r originalCountnewCounts rtest_addObserversz'TrialRunnerTestsMixin.test_addObserverssN D..01   "t))+, =1r!cpt|jjj|jj}t dD]f}|jj |j|j|j|j|jhy)z= Test that a new file is opened on each run. N) r rworkingDirectorychildlogfilerangergrFrestat assertTrueexistsremove)rlogPathis rtest_logFileAlwaysActivez.TrialRunnerTestsMixin.test_logFileAlwaysActives}4;;778>>t{{?R?RSq A KKOODII & NN  OOGNN, - NN   r!N)r)r*r+rZr`rdrkrxr,r!rr^r^ys -2 r!r^ceZdZdZdZdZy)TrialRunnerTestszm Tests for L{runner.TrialRunner} with the feature to turn unclean errors into warnings disabled. ct|_tjt|j|_t d|_y)Nr5r`rr5r TrialRunnerr.rzrFrs rsetUpzTrialRunnerTests.setUps0j (():4;;O $\2 r!cx|jj}|j|jty)z The reporter constructed by L{runner.TrialRunner} is passed L{twisted.python.log} as the value for the C{publisher} parameter. N)r _makeResultassertIdenticalr4r rresults rtest_publisherzTrialRunnerTests.test_publishers, ((* V..4r!N)r)r*r+rZrrr,r!rrzrzs 3 5r!rzceZdZdZdZy)+TrialRunnerWithUncleanWarningsReporterTestsza Tests for the TrialRunner's interaction with an unclean-error suppressing reporter. ct|_tjt|jd|_t d|_y)NTr5uncleanWarningsr`r}rs rrz1TrialRunnerWithUncleanWarningsReporterTests.setUps6j (( dkk4  %\2 r!Nr)r*r+rZrr,r!rrrs  3r!rc.eZdZdZdZdZdZdZdZy) DryRunMixinze Mixin for testing that 'dry run' mode works with various L{pyunit.TestCase} subclasses. cg|_t|_tjt tjj |j|_|jy)Nr|)r rr5rr~r.DRY_RUNmakeTestFixturesrs rrzDryRunMixin.setUpsIj (( v1199$++   r!cy)zh Set C{self.test} and C{self.suite}, where C{self.suite} is an empty TestSuite. Nr,rs rrzDryRunMixin.makeTestFixturesrIr!c|jjtj}|j|jgy)zf If there are no tests, the reporter should not receive any events to report. N)rrg TestSuiterhrrs rr`zDryRunMixin.test_emptys3 !1!1!34 +r!c|jj|j}|j|jgdy)z If we are running a single test, check the reporter starts, passes and then stops the test during a dry run. r:rDr>N)rrgrFrhrrs rtest_singleCaseReportingz$DryRunMixin.test_singleCaseReportings/ + (OPr!c|jj|j|j|jgy)zT When we are doing a dry run, the tests should not actually be run. N)rrgrFrhr rs rtest_testsNotRunzDryRunMixin.test_testsNotRuns,  " 2&r!N) r)r*r+rZrrr`rrr,r!rrrs!   ,Q'r!rceZdZdZdZy)SynchronousDryRunTestszS Check that 'dry run' mode works well with trial's L{SynchronousTestCase}. cGddtj}|d|_tj|_y)NceZdZdZy);SynchronousDryRunTests.makeTestFixtures..PyunitCasecyrr,rs rtest_foozDSynchronousDryRunTests.makeTestFixtures..PyunitCase.test_foor!Nr)r*r+rr,r!r PyunitCaser r!rr)rSynchronousTestCaserFpyunitrsuiterrs rrz'SynchronousDryRunTests.makeTestFixturess2 55 z* %%' r!Nr)r*r+rZrr,r!rrr (r!rceZdZdZdZy) DryRunTestsz@ Check that 'dry run' mode works well with Trial tests. cGfddtj}|d_tj_y)NceZdZfdZy).DryRunTests.makeTestFixtures..MockTestc<jjdy)Nr)r r&)rFrs rrz7DryRunTests.makeTestFixtures..MockTest.test_foos +r!NrrsrMockTestrs ,r!rr)rTestCaserFrrr)rrs` rrzDryRunTests.makeTestFixturess3 ,x(( ,Z( %%' r!Nrr,r!rrrrr!rceZdZdZdZy)PyUnitDryRunTestszJ Check that 'dry run' mode works well with stdlib unittest tests. cGddtj}|d|_tj|_y)NceZdZdZy)6PyUnitDryRunTests.makeTestFixtures..PyunitCasecyrr,rs rrz?PyUnitDryRunTests.makeTestFixtures..PyunitCase.test_foorr!Nrr,r!rrrrr!rr)rrrFrrrs rrz"PyUnitDryRunTests.makeTestFixturess0  z* %%' r!Nrr,r!rrr rr!rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZeZdZdZy) RunnerTestscXtj_tjt j d}dj|dd}|d}tjd|ddd|gfd}tj_ |t_ gdd z_ y) N.zTest Helper ReporterzUtility for unit testing. capturing) descriptionlongOptshortOptklassctj|ttj|g|i|zSr)rhrlistoriginal)ifaceakwpluginsrs r getPluginsz%RunnerTests.setUp..getPlugins/s8   UI .T-$--"@"@R"@AA Ar!r )rOptionsconfigr qualr.splitjoinr _ReporterrrrstandardReport)rpartspackagerrrs` @rrzRunnerTests.setUpsmmo  ./55c:((5":&b   # #&7#     B)) & FJr!c.|jt_yr)rrrrs rtearDownzRunnerTests.tearDown;s MMr!c:|jj|yr)r parseOptionsrr's rrzRunnerTests.parseOptions>s   &r!cbtj|j}t|_|Sr)r _makeRunnerrrr5)rrs r getRunnerzRunnerTests.getRunnerAs$   dkk *:r!c|jg|jd}|j}|j||jj yNr)rrrrhr __class__)rrrs rtest_runner_can_get_reporterz(RunnerTests.test_runner_can_get_reporterFsL "Z(! !3!3!3!5!?!?@r!c|jg|j}|j}|j|j|j dyr)rrrrhrrrrrs rtest_runner_get_resultz"RunnerTests.test_runner_get_resultLsK "!###% ))4;;z+BCr!c|jg|j}|j|jtj y)z By default Trial sets the 'uncleanWarnings' option on the runner to False. This means that dirty reactor errors will be reported as errors. See L{test_reporter.DirtyReactorTests}. N)rrassertNotIsInstancerrUncleanWarningsReporterWrapperrrs r test_uncleanWarningsOffByDefaultz,RunnerTests.test_uncleanWarningsOffByDefaultRsB "!   F   ("I"I r!c|jdg|j}|j|jtj y)z Specifying '--unclean-warnings' on the trial command line will cause reporters to be wrapped in a device which converts unclean errors to warnings. See L{test_reporter.DirtyReactorTests} for implications. z--unclean-warningsN)rrassertIsInstancerrrrs rtest_getsUncleanWarningsz$RunnerTests.test_getsUncleanWarnings^sF /01!  F   ("I"I r!c|jddg|j}|j|jdy)N--temp-directory some_path)rrrhrnrs rtest_runner_working_directoryz)RunnerTests.test_runner_working_directoryjs8 -{;<! 00+>r!c|jg|jtjtjt |j jtjj|j}|jiGfddtj|jd}|j|jz}|r|j|dd|j!j#djj#djdy ) 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(eZdZfdZfdZy)KRunnerTests.test_concurrentImplicitWorkingDirectory..ConcurrentCasectjxd<}tjj|j tj|j dy)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)osgetcwdchdirpath addCleanuprg)rsubsequentDirectoryConcurrentCase runDirectory secondRunnerwheres r test_firstzVRunnerTests.test_concurrentImplicitWorkingDirectory..ConcurrentCase.test_firstsS=?IIKGl#&9**+*=>   !>?r!c4tjd<y)zR Record the working directory for later analysis. recordN)rr)rrs rrzWRunnerTests.test_concurrentImplicitWorkingDirectory..ConcurrentCase.test_seconds#%))+hr!N)r)r*r+rr)rrrrsrrrs @ .r!rrrr$ _trial_tempz _trial_temp-1)rrN)rrrrrr mktempmakedirsrrrrrgerrorsfailuresfailrhro)r firstRunnerrbadrrrrs @@@@r'test_concurrentImplicitWorkingDirectoryz3RunnerTests.test_concurrentImplicitWorkingDirectoryos  " "))+.   .  ""#nn& ~~'  . .X99 .* !=>mmfoo-  IIc!fQi   *00?DD&,,_=BB  r!c|jdtjj|j gtj }|j tj||j}|jGfddtj|jd}|j|jz}|r|j|ddyy)z If a working directory which is already in use is explicitly specified, L{TrialRunner.run} raises L{_WorkingDirectoryBusy}. rc eZdZfdZdZy)KRunnerTests.test_concurrentExplicitWorkingDirectory..ConcurrentCasech|jtjjdy)z Try to start another runner in the same working directory and assert that it raises L{_WorkingDirectoryBusy}. test_failureN) assertRaisesr_WorkingDirectoryBusyrg)rrrs rtest_concurrentz[RunnerTests.test_concurrentExplicitWorkingDirectory..ConcurrentCase.test_concurrents- !!.. $$">2r!c&|jdy)zE Should not be called, always fails. z$test_failure should never be called.N)rrs rrzXRunnerTests.test_concurrentExplicitWorkingDirectory..ConcurrentCase.test_failures @Ar!N)r)r*r+rr)rrsrrrs  Br!rrrr$N)rrrabspathrrrrrrrrgrrr)rinitialDirectoryr rr rrs @@r'test_concurrentExplicitWorkingDirectoryz3RunnerTests.test_concurrentExplicitWorkingDirectorys -rwwt{{}/MNO99; "23nn& ~~'  BX99 B$0A!BCmmfoo-  IIc!fQi  r!c&|jd|jdddg|j}tj}|j dd}|j |}|j|j|jy)Nr --reporterrtwisted.trial.test.sampleT) rrrr TestLoader loadByNamergrhrr)r my_runnerloaderrrs rtest_runner_normalzRunnerTests.test_runner_normals " +   NN$ ""$!!"=tDu% ,,fmm.runcall "&D r!r#N) rr touchr+patchr-Pdbr!rrs)r pdbrcFiler#s` r test_runnerDebuggerDefaultsToPdbz,RunnerTests.test_runnerDebuggerDefaultsToPdbsw 9&ABCW% # ' 377Iw/ DNN,- ++,r!cjgdd_fd}jtjd|j j jjy)zU Trial uses pdb if pdb is passed explicitly to the `--debugger` arg. )rr --debuggerr-r#rFcd_yr)r*r,s rr#zGRunnerTests.test_runnerDebuggerWithExplicitlyPassedPdb..runcallr.r!r#N)rr+r0r-r1r!rrs)rr#s` r*test_runnerDebuggerWithExplicitlyPassedPdbz6RunnerTests.test_runnerDebuggerWithExplicitlyPassedPdbsd   $ ' 377Iw/ DNN,- ++,r!c|jgd|j}|j|}|j|j|j |jdg|j j y)zM Trial uses specified debugger if the debugger is available. )rrr5z4twisted.trial.test.test_runner.RunnerTests.cdebuggerr#rr#N)rrr!rhrrr$)rrrs rtest_runnerDebuggerzRunnerTests.test_runnerDebuggersm   NN$ $$Y/ ,,fmm< )i&8&8&?&?@r!c|jdg|j}|j}|j|tj y)z If trial was passed the C{--exitfirst} option, the constructed test result object is wrapped with L{reporter._ExitWrapper}. z --exitfirstN)rrrrr _ExitWrapperrs rtest_exitfirstzRunnerTests.test_exitfirst0sF =/*!###% fh&;&;.decoratek   dI. /Kr!rYr$N) r0rrrNrFrhr\rfrrrYrrXs @rtest_runUntilFailureDecoratez.UntilFailureTests.test_runUntilFailureDecorateds}    8Z2,,TYY7 !, Y+ dii%;$<=r!cgfd}|jtd|d|j_|jj |j }|j |jd|j td|j |j tf|j tfgy)z C{runUntilFailure} applies the force-gc decoration after the standard L{ITestCase} decoration, but only one time. c.j||f|SrrUrVs rrYzGUntilFailureTests.test_runUntilFailureForceGCDecorate..decorate}rZr!rYTr$rmN) r0rr_forceGarbageCollectionrNrFrhr\rfrrr[s @r#test_runUntilFailureForceGCDecoratez5UntilFailureTests.test_runUntilFailureForceGCDecoratevs    8Z2.2 +,,TYY7 !, Y+  ii #dii1Q%R S r!N) r)r*r+rrrJrrQrPr\r`r,r!rrCrCAs, -FOO -P 7$ >$ r!rCceZdZdZdZdZy)UncleanUntilFailureTestszh Test that the run-until-failure feature works correctly with the unclean error suppressor. ctj|tjtj |j d|_y)NTr)rCrrr~rrLr5rs rrzUncleanUntilFailureTests.setUps3%((   dkk4  r!c@t|jjS)z Get the number of failures that were reported to a result that is wrapped in an UncleanFailureWrapper. )rf_originalReporterrrs rrPz%UncleanUntilFailureTests._getFailuress 6++4455r!N)r)r*r+rZrrPr,r!rrbrbs  6r!rbceZdZdZdZy) BreakingSuitez; A L{TestSuite} that logs an error when it is run. c td#t$r*tjtjYywxYw)Nz#error that occurs outside of a test) RuntimeErrorr errr Failurers rrgzBreakingSuite.runs5 'DE E ' GGGOO% & 's 0AAN)r)r*r+rZrgr,r!rrgrgs 'r!rgc"eZdZdZdZdZdZy)LoggedErrorsTestsa  It is possible for an error generated by a test to be logged I{outside} of any test. The log observers constructed by L{TestCase} won't catch these errors. Here we try to generate such errors and ensure they are reported to a L{TestResult} object. c.|jtyr)flushLoggedErrorsrirs rrzLoggedErrorsTests.tearDowns |,r!cltj}|j|jdy)zg Check that we can construct a L{runner.LoggedSuite} and that it starts empty. rN)r LoggedSuiterhcountTestCases)rrs rtest_constructz LoggedErrorsTests.test_constructs+ ""$ --/3r!ctj}tjt g}|j ||j t|jd|j |jddjtj|j|jddjty)zU Chek that a L{LoggedSuite} reports any logged errors to its result. r$rN)r TestResultrrqrgrgrhrfrid NOT_IN_TESTrscheckri)rrrs rtest_capturesErrorz$LoggedErrorsTests.test_capturesErrors$$&""MO#45 & V]]+Q/ q)!,//163E3EF  a(+11,?@r!N)r)r*r+rZrrsryr,r!rrmrms-4 Ar!rmc$eZdZdZdZdZdZy)TestHolderTestscZd|_tj|j|_yNr)rr TestHolderholderrs rrzTestHolderTests.setUps"(''(8(89 r!c|j|jj|j|j|jj |jy)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)rhrrvrshortDescriptionrs r test_holderzTestHolderTests.test_holdersH )4+;+;< 5579I9IJr!c|j|jt|j|jt t|j|jdtdy)z? L{runner.TestHolder} implements L{ITestCase}. z claims to provide z but does not do so correctly.N)rrrrsrrs rtest_holderImplementsITestCasez.TestHolderTests.test_holderImplementsITestCasesI T[[)DKK*@A  DKK 0{{I ' r!ctj}|jj||j |j |j d|jy)zc A L{runner.TestHolder} can run against the standard Python C{TestResult}. r$N)rrurrgrsrYrhr\rs rtest_runsWithStandardResultz+TestHolderTests.test_runsWithStandardResultsK ""$  ,,./ FOO,r!N)r)r*r+rrrrr,r!rr{r{s:K  -r!r{cReZdZdZedZGddZdZdZdZ dZ d Z y ) ErrorHolderTestsMixinaa This mixin defines test methods which can be applied to a L{runner.ErrorHolder} constructed with either a L{Failure} or a C{exc_info}-style tuple. Subclass this and implement C{setUp} to create C{self.holder} referring to a L{runner.ErrorHolder} instance and C{self.error} referring to a L{Failure} which the holder holds. z"integer division or modulo by zeroc(eZdZdZdZdZdZdZy)$ErrorHolderTestsMixin.TestResultStubz) Stub for L{TestResult}. cg|_yr)rrs rr z-ErrorHolderTestsMixin.TestResultStub.__init__s DKr!cyrr,rEs rr:z.ErrorHolderTestsMixin.TestResultStub.startTest r!cyrr,rEs rr>z-ErrorHolderTestsMixin.TestResultStub.stopTestrr!c>|jj||fyr)rr&rKs rrMz-ErrorHolderTestsMixin.TestResultStub.addError s KK  e} -r!N)r)r*r+rZr r:r>rMr,r!rTestResultStubrs     .r!rctj}|jj||j |j |j d|jy)zd A L{runner.ErrorHolder} can run against the standard Python C{TestResult}. r$N)rrurrgrOrYrhr\rs rrz1ErrorHolderTestsMixin.test_runsWithStandardResultsM ""$  --/0 FOO,r!c2|jj|j|j|jj|j|j j |j j|j jffgy)zM L{runner.ErrorHolder} adds an error to the result when run. N) rrgrrhrrLtypevaluetbrs rtest_runzErrorHolderTestsMixin.test_runsc  $  KK  kkDJJOOTZZ-=-=tzz}}M N O r!c|j|j|j|jj|j|jj |jj |jjffgy)zP L{runner.ErrorHolder} adds an error to the result when called. N)rrrhrrLrrrrs r test_callzErrorHolderTestsMixin.test_call"s_ DKK   KK  kkDJJOOTZZ-=-=tzz}}M N O r!cX|j|jjdy)zH L{runner.ErrorHolder.countTestCases} always returns 0. rN)rhrrrrs rtest_countTestCasesz)ErrorHolderTestsMixin.test_countTestCases,s! 335q9r!cdjt|jjd}|j t|j|y)zh L{runner.ErrorHolder.__repr__} returns a string describing the error it holds. z0r$N)formatreprrrLrh)rexpecteds r test_reprzErrorHolderTestsMixin.test_repr2sG IOO ""1% &  dkk*H5r!N) r)r*r+rZZeroDivisionErrorexceptionForTestsrrrrrrr,r!rrrs8**NO.."-  : 6r!rceZdZdZdZy)FailureHoldingErrorHolderTestsz Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder} when constructed with a L{Failure} representing its error. cd|_ |j#t$rtj|_YnwxYwt j|j|j |_|j|_ yr}) rrrr rkrLr ErrorHolderrrrrs rrz$FailureHoldingErrorHolderTests.setUpDsf( +(( (  + *DJ +(()9)94::F ))+ s "::Nrr,r!rrr>s  ,r!rceZdZdZdZy)ExcInfoHoldingErrorHolderTestsz Tests for L{runner.ErrorHolder} behaving similarly to L{runner.TestHolder} when constructed with a C{exc_info}-style tuple representing its error. cd|_ |j#t$r0tj}t j |_YnwxYwtj|j||_ |j|_ yr}) rrrsysexc_infor rkrLrrrrr)r exceptionInfos rrz$ExcInfoHoldingErrorHolderTests.setUpUso( +(( (  +LLNM *DJ +(()9)9=I ))+ s 6A ANrr,r!rrrOs  ,r!rcReZdZdZGddej ZdZdZdZ dZ y) MalformedMethodTestszR Test that trial manages when test methods don't have correct signatures. c@eZdZdZdZdZejeZy)%MalformedMethodTests.ContainMalformedzV This TestCase holds malformed test methods that trial should handle. cyrr,)rblahs rrz.MalformedMethodTests.ContainMalformed.test_fookrr!cyrr,r,r!rtest_barz.MalformedMethodTests.ContainMalformed.test_barnrr!N) r)r*r+rZrrrinlineCallbacks test_spamr,r!rContainMalformedrfs%   *E))(3 r!rcnt}tjtj|}t j |}|j|}|j|jd|j|j|jt|jdy)zL Wrapper for one of the test method of L{ContainMalformed}. r|r$N)rrr~rrLrrrgrhr\rOrYrfr)rr<r5 trialRunnerrFrs r_testzMalformedMethodTests._testss(():):6J #44V<& !, --/0 V]]+Q/r!c&|jdy)zE Test when the method has extra (useless) arguments. rNrrs r test_extraArgz"MalformedMethodTests.test_extraArg :r!c&|jdy)zJ Test when the method doesn't have even self as argument. rNrrs r test_noArgzMalformedMethodTests.test_noArgrr!c&|jdy)z5 Test a decorated method also fails. rNrrs rtest_decoratedz#MalformedMethodTests.test_decorateds ;r!N) r)r*r+rZrrrrrrrr,r!rrras+ 46?? 4 0   r!rc"eZdZdZdZdZdZy)DestructiveTestSuiteTestsz2 Test for L{runner.DestructiveTestSuite}. cPgGfddtj}|d}tj}t j |g}|j g|j||j dg|j |jdy)zL Thes destructive test suite should run the tests normally. ceZdZfdZy)6DestructiveTestSuiteTests.test_basic..MockTestc(jdyr)rUrFcalleds rrz?DestructiveTestSuiteTests.test_basic..MockTest.test_foos d#r!Nrrsrrrs $r!rrTrN) rrrrurDestructiveTestSuiterhrgrr)rrrFrrrs @r test_basicz$DestructiveTestSuiteTests.test_basics $v $ #$$&++TF3 $ & $( --/3r!cgGfddtj}tj}t j }tj |_|j|}|jg|j||jdg|j|jdy)zu Test the C{shouldStop} management: raising a C{KeyboardInterrupt} must interrupt the suite. c(eZdZfdZdZfdZy);DestructiveTestSuiteTests.test_shouldStop..MockTestc(jdy)Nr$rUrs r test_foo1zEDestructiveTestSuiteTests.test_shouldStop..MockTest.test_foo1 a r!ctr)KeyboardInterruptrFs r test_foo2zEDestructiveTestSuiteTests.test_shouldStop..MockTest.test_foo2s '))r!c(jdy)NrmrUrs r test_foo3zEDestructiveTestSuiteTests.test_shouldStop..MockTest.test_foo3rr!N)r)r*r+rrrrsrrrs ! * !r!rr$N) rrrrurrr suiteFactory loadClassrhrgrr)rrrrrrs @rtest_shouldStopz)DestructiveTestSuiteTests.test_shouldStops  !x(( !$$&""$$99  * $ & !% --/3r!c<Gddtj}|d}tj}t j |g}|j |jd|j||j |jdy)zn Checks that the test suite cleanups its tests during the run, so that it ends empty. ceZdZdZy)8DestructiveTestSuiteTests.test_cleanup..MockTestcyrr,rs rrzADestructiveTestSuiteTests.test_cleanup..MockTest.test_foorr!Nrr,r!rrrrr!rrr$rN) rrrrurrrhrrrg)rrrFrrs r test_cleanupz&DestructiveTestSuiteTests.test_cleanups|  v  #$$&++TF3 --/3 & --/3r!N)r)r*r+rZrrrr,r!rrrs4$464r!rc6eZdZGddejZy)RunnerDeprecationTestsc4eZdZdZdZdZdZdZdZdZ dZ y)#RunnerDeprecationTests.FakeReporterz Fake reporter that does *not* implement done() but *does* implement printErrors, separator, printSummary, stream, write and writeln without deprecations. Ncyrr,rs r printErrorsz/RunnerDeprecationTests.FakeReporter.printErrorsrr!cyrr,rs r printSummaryz0RunnerDeprecationTests.FakeReporter.printSummaryrr!cyrr,rs rwritez)RunnerDeprecationTests.FakeReporter.writerr!cyrr,rs rwritelnz+RunnerDeprecationTests.FakeReporter.writelnrr!) r)r*r+rZrHr[r5rrrrr,r!r FakeReporterrs,      r!rN)r)r*r+rrLrr,r!rrrsx((r!rceZdZdZdZy)QualifiedNameWalkerTestsz< Tests for L{twisted.trial.runner._qualNameWalker}. c|ttjd}|j|dgfddgfdddgfgy)z C{_qualNameWalker} is a generator that, when given a Python qualified name, yields that name, and then the parent of that name, and so forth, along with a list of the tried components, in a 2-tuple. zwalker.texas.rangerz walker.texasrangerwalkertexasN)rr_qualNameWalkerrh)r walkerResultss rtest_walksDownPathz+QualifiedNameWalkerTests.test_walksDownPathsO V334IJK   &+(,GX./  r!N)r)r*r+rZrr,r!rrrs  r!rceZdZdZdZy)TrialMainDoesNothingTestszl Importing L{twisted.trial.__main__} will not run the script unless it is actually C{__main__}. ctdy)zO If we import L{twisted.trial.__main__}, it should do nothing. ztwisted.trial.__main__N) __import__rs rtest_importDoesNothingz0TrialMainDoesNothingTests.test_importDoesNothing s +,r!N)r)r*r+rZrr,r!rrrs  -r!r)@rr-rrriortypingrzope.interfacerzope.interface.verifyrtwistedrtwisted.internetrtwisted.pluginsr twisted.pythonr r r twisted.python.filepathr twisted.python.reflectrtwisted.scriptsr twisted.trialrrrtwisted.trial._asyncrunnerrtwisted.trial.itrialrrrr.r^rrzrrrrrrr?rCrbrrgrmr{rrrrrrrrr,r!rr s &.")00,+!::G5%% YN N N b##L5,h.J.J5( 3877 3 )')'X ([(*F*F ( (+x;; ( ( X%A%A (_=(.._=D 4h224 I 44I X606( 'F$$ 'A44A>!-h22!-HK6K6\,%:O,",%:O,$. 877. bA4 < <A4HX992 x;; . - < < -r!