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

Function test_spawn_uses_tmphome

testing/test_pytester.py:703–720  ·  view source on GitHub ↗
(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("HOME") == tmphome
706
707 pytester._monkeypatch.setenv("CUSTOMENV", "42")
708
709 p1 = pytester.makepyfile(
710 f"""
711 import os
712
713 def test():
714 assert os.environ["HOME"] == {tmphome!r}
715 assert os.environ["CUSTOMENV"] == "42"
716 """
717 )
718 child = pytester.spawn_pytest(str(p1))
719 out = child.read()
720 assert child.wait() == 0, out.decode("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

Used in the wild real call sites across dependent graphs

searching dependent graphs…