[Twisted-Python] testing a unit that spawnsProcess

Nathaniel Haggard natester at gmail.com
Wed Oct 21 14:23:30 EDT 2009


What is a good way to unit test this amp responder which will call a
process?  Other things it does are covered with other tests thanks
to the tests I copied from lp:game.  That should be a pretty awesome
game or at least it will work.

Should the test actually spawn a process or only pretend to?
test_process already tests spawnProcess after all.


   def test_StartProcess(self):
       """
       When L{StartProcess} is issued client starts a process and
returns a status code
       """
       responder = self.controller.lookupFunction(StartProcess.commandName)
       d = responder({
               'identifier': self.identifier,
               'cmd':'/bin/ls',
               'args':''
               })

       def gotStartProcess(a):
           # assert something about the process
                                                       <---- what goes here?
       d.addCallback(gotStartProcess)
       return d



More information about the Twisted-Python mailing list