[Twisted-Python] Testing Twisted code without trial
glyph at twistedmatrix.com
Mon Mar 25 19:13:05 EDT 2013
On Mar 25, 2013, at 6:48 AM, exarkun at twistedmatrix.com wrote:
> * with returning a `Deferred` from a test method (which works even if
> you don't use trial to run your tests - but not if you don't subclass
> trial's `TestCase`). We eventually moved on from this idea, though many
> parts of Twisted itself are still tested using this feature, to...
I have a minor quibble with saying we have "moved on" from this idea.
Trial is useful both for writing unit tests (which use MemoryReactor, Clock, etc) and for writing integration tests (which return Deferreds and do real I/O).
Twisted *itself* is mostly tested with unit tests that test smaller chunks of functionality, and there are rarely (perhaps never) good reasons to return a Deferred from a test case within Twisted's own test suite, but I maintain lots of test code that depends intimately on the return-a-Deferred functionality, and other, higher-level projects do too.
We have no plans to remove or deprecate this functionality, but it's important to know that you should not use it unless you really need it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python