MCPcopy
hub / github.com/pypa/pipx / test_subprocess_pythonsafepath_set_for_python_commands

Function test_subprocess_pythonsafepath_set_for_python_commands

tests/test_util.py:28–34  ·  view source on GitHub ↗

Test that PYTHONSAFEPATH is set for Python subprocess calls to prevent CWD shadowing (issue #1575).

()

Source from the content-addressed store, hash-verified

26
27
28def test_subprocess_pythonsafepath_set_for_python_commands() -> None:
29 """Test that PYTHONSAFEPATH is set for Python subprocess calls to prevent CWD shadowing (issue #1575)."""
30 result = run_subprocess(
31 [sys.executable, "-c", "import os, sys; sys.stdout.write(os.environ.get('PYTHONSAFEPATH', ''))"]
32 )
33
34 assert result.stdout == "1"

Callers

nothing calls this directly

Calls 1

run_subprocessFunction · 0.90

Tested by

no test coverage detected