def METHOD_NAME(self, capsys):
    # force standalone repo profiles cache regen
    with patch("sys.argv", self.args + ["-uf"]):
        with pytest.raises(SystemExit):
            self.script()
    # fail to forcibly remove all
    with patch("pkgcheck.addons.caches.shutil.rmtree") as rmtree, patch(
        "sys.argv", self.args + ["-Rf"]
    ):
        rmtree.side_effect = IOError("bad perms")
        with pytest.raises(SystemExit) as excinfo:
            self.script()
        out, err = capsys.readouterr()
        assert not out
        assert err.strip() == "pkgcheck cache: error: failed removing cache dir: bad perms"
        assert excinfo.value.code == 2
    # actually forcibly remove all
    with patch("sys.argv", self.args + ["-Rf"]):
        with pytest.raises(SystemExit) as excinfo:
            self.script()
        out, err = capsys.readouterr()
        assert (out, err) == ("", "")
        assert excinfo.value.code == 0
    # cache dir has been entirely blown away
    assert not os.path.exists(self.cache_dir)
    # forcing removal again does nothing
    with patch("sys.argv", self.args + ["-Rf"]):
        with pytest.raises(SystemExit) as excinfo:
            self.script()
        out, err = capsys.readouterr()
        assert (out, err) == ("", "")
        assert excinfo.value.code == 0