[Twisted-Python] trial internals help?

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue May 19 05:31:13 MDT 2015


On 10:50 am, wsanchez at wsanchez.net wrote:
>  I took a stab at porting trial to use twisted.logger 
>(http://tm.tl/7863) but I have a test failing:
>
>twisted.trial.test.test_reporter.TestErrorReporting.test_hiddenException
>
>  I don’t quite know what that test is doing.  I added some additional 
>output on my branch (branches/log-trial-7863) but that didn’t make me 
>any smarter.
>
>  Is anyone familiar with this code able to explain how I may have 
>broken it?
>
>         -wsv

Hi Wilfredo,

This looks like a test for the logging done in the implementation of 
`IReactorTime`.

The test runs another test, `testHiddenException`. 
`testHiddenException` uses `reactor.callLater` to run a function that 
raises an exception.  Then `testHiddenException` does a horrible thing 
to the reactor to make the delayed call run (and thus raise the 
exception which it then expects to be attributed to the running test as 
an error).  Then it *also* fails the test - I suppose because at some 
point there was a bug where "failure" results interfered with "error" 
results somehow.

I don't see how this test is particularly different from one like:

    def test_hiddenException(self):
        try:
            raise SomeException()
        except:
            log.deferr()
        self.fail("something else")

Does your branch need to port the `IReactorTime` exception handling to 
the new logging API?  Or maybe it needs to port the way Trial itself 
integrates with the logging system so that it can observe failures like 
this one?

Jean-Paul




More information about the Twisted-Python mailing list