[Twisted-Python] unit testing question: twisted with tk
Russell E. Owen
rowen at uw.edu
Wed Jul 18 13:01:06 EDT 2012
I have a bit of code that combines twisted with Tkinter
and now I'd like to write some unittests for it.
I can't seem to figure out how to get TwistedTrial to handle this case.
I've written a unit test like this:
from twisted.trial import unittest
from twisted.internet.defer import Deferred
root = Tkinter.Tk()
from twisted.internet import reactor
the one test so far returns a deferred and calls errback on that
deferred if the test fails, and callback if it succeeds. When I run the
unit test with trial I get this error error:
I have an identical unit test for a pure-twisted version of my
communication code (no Tk) and it works fine.
I am guessing the problem is cleanly getting rid of Tkinter's root at
the end of the test and disentangling it from the reactor, but I have no
idea how to do that.
Any suggestions on how to proceed (e.g. a way to get TwistedTrial to
work, or a good alternative)?
More information about the Twisted-Python