[Twisted-Python] testing my application
Marcin.Kasperski at softax.com.pl
Thu Oct 20 09:19:15 EDT 2005
Dnia czwartek, 20 października 2005 13:16, Stefano Canepa
> Hi all,
> I am looking for a simple way to write test cases for my
> project. What is the right way to be as standard as possible?
> I know the application works becouse I developed a client and
> the server speaking the same protocol and used lots of print
> to have output and a sniffer to see network trafic but I
> understand this is not the right way.
Hmm, I have the similar problem. I have been using python
unittest to test my application components but recently I
started to write classess which return deferreds and I am not
sure how to test them.
First I tried to use standard unittest and install callbacks
which call self.fail or self.succeed - but it seems that the
errors are just ignored.
Then I found on this list note about deferredResult and tried
using it (keeping normal unittest) but seems the application
just hangs here (for the simple reason I guess, no reactor is
Then I found about twisted.trial.unittest. But when I replaced
import unittest with from twisted.trial import unittest, I found
that there is no 'main' function in this module.
What should I do? Go back to normal unittest but start some
reactor before unittest.main() ?
Does there anywhere exist any complete ***standalone*** test
example (run for itself instead of being run within whole
twisted test framework)?
More information about the Twisted-Python