def test_arbiter_reap_workers(mock_os_waitpid): mock_os_waitpid.side_effect = [(42, 0), (0, 0)] arbiter = gunicorn.arbiter.Arbiter(DummyApplication()) arbiter.cfg.settings['child_exit'] = mock.Mock() mock_worker = mock.Mock() arbiter.WORKERS = {42: mock_worker} arbiter.reap_workers() mock_worker.tmp.close.assert_called_with() arbiter.cfg.child_exit.assert_called_with(arbiter, mock_worker)