On Jan 26, 2009, at 8:00 AM, Alessio Pace wrote:
The point is that I must assure multiple test classes have their test methods run within an active reactor. So somewhere a reactor.run() has to be called.. Necessarily, if I want that my tests battery to terminate, a reactor.stop() must be invoked by somebody, otherwise the main loop remains running...

The trivial -and not working- idea was to do reactor.run() / reactor.stop() in setUp() / tearDown() methods.

Trial takes care of starting and stopping the reactor for you. Just write your tests assuming the reactor is already running. I believe it will restart the reactor between every test, so you're always dealing with a 'fresh' reactor.

You can also select which reactor to use inside Trial with the -- reactor parameter (call `trial --help-reactors` for more). That's usually not necessary unless you have a special case that requires a particular reactor.

-phil

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to