Code review comment for ~cjwatson/launchpad:publish-single-archive-option

Revision history for this message
Colin Watson (cjwatson) wrote :

The `inlineCallbacks`/`yield` stuff is because we need to run some Twisted code to set up an in-process key server and set up signing keys for test archives. That code is asynchronous - i.e. it returns a `Deferred`, which is a promise to eventually deliver either a result or an error, rather than directly returning a result, because it's doing network communication that might block.

However, in the case of this test we essentially just want to convert that asynchronous code into synchronous code by waiting for each deferred result to appear. `yield` within `inlineCallbacks` does that. Technically this is a generator, but it's best not to think of it as generating a sequence of values: just think of each `yield` as a point where we stop and wait for some asynchronous code to complete, and you'll be pretty close.

« Back to merge proposal