← Back to team overview

testtools-dev team mailing list archive

Re: [Merge] lp:~jml/testtools/deferred-support into lp:testtools

 

On Tue, Oct 12, 2010 at 1:46 AM, Jonathan Lange <jml@xxxxxxxxx> wrote:
> However, I'm not in a rush to push those changes through:
>  * _Spinner cannot go into Twisted as-is until Twisted stops using
> setUpClass. It would have to become less strict. I don't want that for
> my testtools-using code.
>  * Putting extract_result into Twisted has been discussed in the
> past, but it has been discouraged because it encourages newbies to
> abuse it.
>  * trap_unhandled_errors is kind of a hack. It only works here
> because we're controlling the reactor and making assumptions about
> test isolation.

^ So, its up to you :).
>>> +    def _run_user(self, function, *args):
>>> +        d = defer.maybeDeferred(function, *args)
>>> +        def got_exception(failure):
>>> +            return self._got_user_exception(
>>> +                (failure.type, failure.value, failure.tb))
>>> +        d.addErrback(got_exception)
>>> +        result = extract_result(d)
>>> +        return result
>>
>> There's no reason for got_exception to be an inner function here.
>>
>
> You mean it should be a lambda or you mean it should be a method? It's
> all the same to me, as long as it's not a part of the interface.

def _got_errback(failure):
   ...

> I'd be very reluctant to put this code into the standard library as
> is. It's experimental, and the Twisted community frowns strongly on
> anything that turns async code to sync. However, if you just mean the
> RunTest mechanism, I'd be less reluctant, but still think it needs
> more usage out in the wild before standardizing. (e.g. there's no
> convenient syntax for using a different RunTest object)

What I mean is that once this is working we're in a position to have
an extensible core appropriate for trial to build on.

Not that its done :)

-Rob
-- 
https://code.launchpad.net/~jml/testtools/deferred-support/+merge/38080
Your team testtools developers is requested to review the proposed merge of lp:~jml/testtools/deferred-support into lp:testtools.



References