@mock.patch("os._exit", **PATCH_OPTS)
@mock.patch("os.setsid", **PATCH_OPTS)
def test_daemon_spawn_child(self, *args):
with mock.patch("os.fork", **PATCH_OPTS) as mock_fork:
mock_fork.return_value = 0// Simulate the child.
self.pm.daemon_spawn()
After Change
self.pm.daemon_spawn()
def test_daemon_spawn_child(self, *args):
with self.mock_daemonize_context(chk_post_child=True) as mock_fork:
mock_fork.return_value = 0// Simulate the child.
self.pm.daemon_spawn()