Unit testing daemon creation
Ben Finney
ben at benfinney.id.au
Wed Mar 21 03:52:39 EDT 2007
Howdy all,
I'm in the process of creating a daemon program using Python. I know
that the program needs to 'os.fork()', then branch based on the return
value and either exit (if the parent) or continue (if the child).
How can I unit test that? That is to say, how can I programmatically
test that functionality of daemonisation from an external module which
imports the daemon module for testing?
I could be hackish and simply clobber the existing 'os.fork' for the
purpose of the unit test, making a stub function that returns the
appropriate values for the test. Is there a better way?
--
\ "Beware of and eschew pompous prolixity." -- Charles A. |
`\ Beardsley |
_o__) |
Ben Finney
More information about the Python-list
mailing list