[Twisted-Python] testing my application

Jp Calderone exarkun at divmod.com
Fri Oct 21 23:45:38 EDT 2005

On Thu, 20 Oct 2005 16:05:03 +0200, Marcin Kasperski <marcin.kasperski at softax.com.pl> wrote:
>Thanks for the info. Running tests vai 'trial test_x.foo' has unpleasant effect of not allowing debugging but simple trick works:
>   if __name__ == "__main__":
>      import twisted.scripts.trial
>      import sys
>      sys.argv = ['-m', 'my_test' ]
>      twisted.scripts.trial.run()
>(BTW, what about patching run so it could get parameters and fallback to argv only when they are not given?)

Just so you know, and in case anyone reading isn't familiar with it, trial has a debug mode.  If you pass the -b flag, it will automatically set up pdb, plus a couple other Twisted-specific features that come in fairly handy.  twistd also supports this, letting you break into pdb at any point while the app is running, and also stopping for unhandled errors.


More information about the Twisted-Python mailing list