Home / Function/ test_host_policy_respects_process_group_flag() — langchain Function Reference

test_host_policy_respects_process_group_flag() — langchain Function Reference

Architecture documentation for the test_host_policy_respects_process_group_flag() function in test_shell_execution_policies.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102["test_host_policy_respects_process_group_flag()"]
  6b16168d_9880_7f41_060c_9fcd5b337996["test_shell_execution_policies.py"]
  a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102 -->|defined in| 6b16168d_9880_7f41_060c_9fcd5b337996
  06707227_971c_bfbd_5596_639762857cca["_make_resource()"]
  a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102 -->|calls| 06707227_971c_bfbd_5596_639762857cca
  style a2c56ce3_9fe1_0edc_b3ed_7c236ce4c102 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py lines 144–163

def test_host_policy_respects_process_group_flag(
    monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
    fake_resource = _make_resource(with_prlimit=True)
    monkeypatch.setattr(_execution, "resource", fake_resource, raising=False)
    monkeypatch.setattr(sys, "platform", "linux")

    recorded: dict[str, Any] = {}

    def fake_launch(*_args: Any, start_new_session: bool, **_kwargs: Any) -> subprocess.Popen[str]:
        recorded["start_new_session"] = start_new_session
        return Mock(spec=subprocess.Popen, pid=1111)

    monkeypatch.setattr(_execution, "_launch_subprocess", fake_launch)

    policy = HostExecutionPolicy(create_process_group=False)
    env = {"PATH": os.environ.get("PATH", "")}
    policy.spawn(workspace=tmp_path, env=env, command=("/bin/sh",))

    assert recorded["start_new_session"] is False

Domain

Subdomains

Frequently Asked Questions

What does test_host_policy_respects_process_group_flag() do?
test_host_policy_respects_process_group_flag() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py.
Where is test_host_policy_respects_process_group_flag() defined?
test_host_policy_respects_process_group_flag() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py at line 144.
What does test_host_policy_respects_process_group_flag() call?
test_host_policy_respects_process_group_flag() calls 1 function(s): _make_resource.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free