MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_mktemp

Function test_mktemp

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

Source from the content-addressed store, hash-verified

99
100@pytest.mark.parametrize("basename, is_ok", testdata)
101def test_mktemp(pytester: Pytester, basename: str, is_ok: bool) -> None:
102 mytemp = pytester.mkdir("mytemp")
103 p = pytester.makepyfile(
104 """
105 def test_abs_path(tmp_path_factory):
106 tmp_path_factory.mktemp('{}', numbered=False)
107 """.format(
108 basename
109 )
110 )
111
112 result = pytester.runpytest(p, "--basetemp=%s" % mytemp)
113 if is_ok:
114 assert result.ret == 0
115 assert mytemp.joinpath(basename).exists()
116 else:
117 assert result.ret == 1
118 result.stdout.fnmatch_lines("*ValueError*")
119
120
121def 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
formatMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected