def METHOD_NAME(self, kill_mock, tmpdir):
    """
    Test the Kill method from the ProjectManager class.
    Mocks the os.kill used inside the kill method
    """
    config = build_config_from_dicts({"barman_lock_directory": tmpdir.strpath})
    config.name = "main"
    # Acquire a lock, simulating a running process
    with ServerWalReceiveLock(tmpdir.strpath, "main"):
        # Build a ProcessManager and retrieve the receive-wal process
        pm = ProcessManager(config)
        pi = pm.list("receive-wal")[0]
        # Exit at the first invocation of kill (this is a failed kill)
        kill_mock.side_effect = OSError(errno.EPERM, "", "")
        kill = pm.kill(pi)
        # Expect the kill result to be false
        assert kill is False
        assert kill_mock.call_count == 1
        kill_mock.assert_called_with(pi.pid, 2)
        kill_mock.reset_mock()
        # Exit at the second invocation of kill (this is a successful kill)
        kill_mock.side_effect = [None, OSError(errno.ESRCH, "", "")]
        # Expect the kill result to be true
        kill = pm.kill(pi)
        assert kill
        assert kill_mock.call_count == 2
        kill_mock.assert_has_calls([mock.call(pi.pid, 2), mock.call(pi.pid, 0)])
        kill_mock.reset_mock()
        # Check for the retry feature. exit at the second iteration of the
        # kill cycle
        kill_mock.side_effect = [None, None, OSError(errno.ESRCH, "", "")]
        kill = pm.kill(pi)
        assert kill
        assert kill_mock.call_count == 3
        kill_mock.assert_has_calls(
            [mock.call(pi.pid, 2), mock.call(pi.pid, 0), mock.call(pi.pid, 0)]
        )