[Twisted-Python] Trial Test Runner

Markus Schiltknecht markus at bluegap.ch
Fri Nov 17 13:22:09 MST 2006


Hi,

Ralph Meijer wrote:
> Maybe you test too much. In general you don't need actual network
> connections to test protocols. For example, there are helpers in
> twisted.test.proto_helpers for mimicking a transport.

I want to test for example, how a program (written in C) reacts to 
network delays or outages. I absolutely need (and already have) python 
code to emulate the network layer.

Of course I could test just one instance of the program, but then I'd 
have to write a dummy peer, just for the tests. Instead, it seems a lot 
easier to use the real code itself and check if two processes correctly 
talk to each other. It's a Multi-Master protocol.

I would like to simulate some of the dirty stuff that can happen to an 
application out in the wild (OOM kill, network delays and outages, etc..).

Another requirement I'm facing is benchmarks. How well does the 
application cope with different a packet loss rate of 10% compared to no 
packet losses?

So, if you tell me I want to do to much with unit tests, that's fine, I 
don't need to run unit tests. They are probably not designed for what I 
want to do. But what else can I use? Is there anything you know which 
could possibly fulfill these requirements?

IMO, twisted itself looks very nice in that it is event-based and 
provides very good interfaces to network protocols as well as managing 
sub-processes. Perhaps I just need to write my own test runners on top 
of twisted and forget about trial.

OTOH, wouldn't it be sufficient to add setUp and tearDown methods for 
TrialSuites? I'm investigating into that direction.

Regards

Markus





More information about the Twisted-Python mailing list