← Back to team overview

launchpad-dev team mailing list archive

Re: testtools and lingering DelayedCalls

 

On Mon, Apr 2, 2012 at 6:50 AM, Jonathan Lange <jml@xxxxxxxxx> wrote:
> On Mon, Apr 2, 2012 at 3:20 AM, Benji York <benji.york@xxxxxxxxxxxxx> wrote:
>> As part of the yellow suqad's test parallelization work I am tracking
>> down a test ordering bug (963463).  The problem is that some tests leave
>> unexecuted DelayedCalls in the reactor which testtools reports as a test
>> error.
>>
>> Normally that would be a good thing, but not all the offending tests use
>> testtools so we have a situation where some tests leave the reactor in a
>> dirty state (which is not reported because those tests are not using
>> testtools) and a later test (which does use testtools) generates an
>> error (because of the already dirty reactor).
>>
>> I am going to try to try to find a way to identify all of the offending
>> tests and clean them up, but I doubt I can find and fix them all within
>> a reasonable time box.
>>
>
> I'm pretty sure it's only the distribution_mirrorprober tests.

After further investigation, I think you're right.  I've added cleanup
code to the tearDowns in test_distributionmirror_prober.py that needed
it, fixing all the known errors.

>> I would like to propose changing testtools such that if the reactor is
>> dirty at the start of a test a warning is issued and the reactor is
>> cleared out.  That way we only generate errors when we can pinpoint the
>> culprit test.
>
> I think I'd be OK with something along those lines. Note that
> testtools itself (I think) cleans out the reactor as it's generating
> those warnings, so you'll only see such behaviour when you are mixing
> it with other Twisted testing approaches.

The problem was that it wasn't a warning, but an exception.  At this
point it's moot for the LP tests, though, so I don't plan on going ahead
with changing testtools.

Thanks for the info, it helped a lot.
-- 
Benji York


References