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

Function test_spawn_uses_tmphome

testing/test_pytester.py:718–737  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

716
717
718def test_spawn_uses_tmphome(pytester: Pytester) -> None:
719 tmphome = str(pytester.path)
720 assert os.environ.get("HOME") == tmphome
721
722 pytester._monkeypatch.setenv("CUSTOMENV", "42")
723
724 p1 = pytester.makepyfile(
725 """
726 import os
727
728 def test():
729 assert os.environ["HOME"] == {tmphome!r}
730 assert os.environ["CUSTOMENV"] == "42"
731 """.format(
732 tmphome=tmphome
733 )
734 )
735 child = pytester.spawn_pytest(str(p1))
736 out = child.read()
737 assert child.wait() == 0, out.decode("utf8")
738
739
740def test_run_result_repr() -> None:

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected