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

Function test_mktemp

testing/test_tmpdir.py:308–323  ·  view source on GitHub ↗
(pytester: Pytester, basename: str, is_ok: bool)

Source from the content-addressed store, hash-verified

306
307@pytest.mark.parametrize("basename, is_ok", testdata)
308def test_mktemp(pytester: Pytester, basename: str, is_ok: bool) -> None:
309 mytemp = pytester.mkdir("mytemp")
310 p = pytester.makepyfile(
311 f"""
312 def test_abs_path(tmp_path_factory):
313 tmp_path_factory.mktemp('{basename}', numbered=False)
314 """
315 )
316
317 result = pytester.runpytest(p, f"--basetemp={mytemp}")
318 if is_ok:
319 assert result.ret == 0
320 assert mytemp.joinpath(basename).exists()
321 else:
322 assert result.ret == 1
323 result.stdout.fnmatch_lines("*ValueError*")
324
325
326def test_tmp_path_always_is_realpath(pytester: Pytester, monkeypatch) -> None:

Callers

nothing calls this directly

Calls 5

fnmatch_linesMethod · 0.80
mkdirMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected