def test_confcutdir_check_isdir(self, pytester: Pytester) -> None:
        """Give an error if --confcutdir is not a valid directory (#2078)"""
        exp_match = r"^--confcutdir must be a directory, given: "
        with pytest.raises(pytest.UsageError, match=exp_match):
            pytester.parseconfig("--confcutdir", pytester.path.joinpath("file"))
        with pytest.raises(pytest.UsageError, match=exp_match):
            pytester.parseconfig("--confcutdir", pytester.path.joinpath("nonexistent"))

        p = pytester.mkdir("dir")
        config = pytester.parseconfig("--confcutdir", p)
        assert config.getoption("confcutdir") == str(p)
Give an error if --confcutdir is not a valid directory (#2078)
testing/test_config.py