def METHOD_NAME():
    """
    Tests to remove the specified kernel module
    """
    mod = "cheese"
    err_msg = "Cannot find module: it has been eaten"
    mock_persist = MagicMock(return_value={mod})
    mock_lsmod = MagicMock(
        return_value=[{"size": 100, "module": None, "depcount": 10, "deps": None}]
    )
    mock_run_all_0 = MagicMock(return_value={"retcode": 0})
    mock_run_all_1 = MagicMock(return_value={"retcode": 1, "stderr": err_msg})
    with patch("salt.modules.kmod._remove_persistent_module", mock_persist):
        with patch(
            "salt.utils.path.which",
            MagicMock(side_effect=[None, "/sbin/rmmod", "/sbin/rmmod", "/sbin/rmmod"]),
        ), patch("salt.modules.kmod.lsmod", mock_lsmod):
            with patch.dict(kmod.__salt__, {"cmd.run_all": mock_run_all_0}):
                with pytest.raises(CommandExecutionError):
                    kmod.remove(mod)
                assert [mod] == kmod.remove(mod, True)
                assert [] == kmod.remove(mod)
            with patch.dict(kmod.__salt__, {"cmd.run_all": mock_run_all_1}):
                assert "Error removing module {}: {}".format(
                    mod, err_msg
                ) == kmod.remove(mod, True)