MCPcopy
hub / github.com/pytest-dev/pytest / test_confcutdir_check_isdir

Method test_confcutdir_check_isdir

testing/test_config.py:1331–1341  ·  view source on GitHub ↗

Give an error if --confcutdir is not a valid directory (#2078)

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1329 assert get_ini_default_for_type(type) == expected
1330
1331 def test_confcutdir_check_isdir(self, pytester: Pytester) -> None:
1332 """Give an error if --confcutdir is not a valid directory (#2078)"""
1333 exp_match = r"^--confcutdir must be a directory, given: "
1334 with pytest.raises(pytest.UsageError, match=exp_match):
1335 pytester.parseconfig("--confcutdir", pytester.path.joinpath("file"))
1336 with pytest.raises(pytest.UsageError, match=exp_match):
1337 pytester.parseconfig("--confcutdir", pytester.path.joinpath("nonexistent"))
1338
1339 p = pytester.mkdir("dir")
1340 config = pytester.parseconfig("--confcutdir", p)
1341 assert config.getoption("confcutdir") == str(p)
1342
1343 @pytest.mark.parametrize(
1344 "names, expected",

Callers

nothing calls this directly

Calls 3

getoptionMethod · 0.80
parseconfigMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected