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

Function test_spawn_uses_tmphome

testing/test_pytester.py:703–720  ·  testing/test_pytester.py::test_spawn_uses_tmphome
(pytester: Pytester)

Source from the content-addressed store, hash-verified

701
702
703def test_spawn_uses_tmphome(pytester: Pytester) -> None:
704 tmphome = str(pytester.path)
705 assert os.environ.get(class="st">"HOME") == tmphome
706
707 pytester._monkeypatch.setenv(class="st">"CUSTOMENV", class="st">"42")
708
709 p1 = pytester.makepyfile(
710 fclass="st">"""
711 import os
712
713 def test():
714 assert os.environ[class="st">"HOME"] == {tmphome!r}
715 assert os.environ[class="st">"CUSTOMENV"] == class="st">"42"
716 class="st">"""
717 )
718 child = pytester.spawn_pytest(str(p1))
719 out = child.read()
720 assert child.wait() == 0, out.decode(class="st">"utf8")
721
722
723def test_run_result_repr() -> None:

Callers

nothing calls this directly

Calls 5

setenvMethod · 0.80
getMethod · 0.45
makepyfileMethod · 0.45
spawn_pytestMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected