'Child should fork, then exit if parent.'

def test_child_forks_next_parent_exits(self):

    test_pids = [0, 42]
    scaffold.mock('os.fork', returns_iter=test_pids, tracker=self.mock_tracker)
    expect_mock_output = '                                                Called    os.fork()\n                                                Called    os.setsid()\n                                                Called    os.fork()\n                                                Called    os._exit(0)\n                                                '
    self.failUnlessRaises(self.FakeOSExit, daemon.daemon.detach_process_context)
    self.failUnlessMockCheckerMatch(expect_mock_output)
