Home / Function/ test_host_policy_falls_back_to_rlimit_data() — langchain Function Reference

test_host_policy_falls_back_to_rlimit_data() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1aea1c6e_6e21_31eb_09d1_ea16754ea9cf["test_host_policy_falls_back_to_rlimit_data()"]
  6b16168d_9880_7f41_060c_9fcd5b337996["test_shell_execution_policies.py"]
  1aea1c6e_6e21_31eb_09d1_ea16754ea9cf -->|defined in| 6b16168d_9880_7f41_060c_9fcd5b337996
  06707227_971c_bfbd_5596_639762857cca["_make_resource()"]
  1aea1c6e_6e21_31eb_09d1_ea16754ea9cf -->|calls| 06707227_971c_bfbd_5596_639762857cca
  style 1aea1c6e_6e21_31eb_09d1_ea16754ea9cf 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 166–185

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

    def fake_launch(*_args: Any, **_kwargs: Any) -> subprocess.Popen[str]:
        return Mock(spec=subprocess.Popen, pid=2222)

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

    policy = HostExecutionPolicy(cpu_time_seconds=7, memory_bytes=2048)
    env = {"PATH": os.environ.get("PATH", "")}
    policy.spawn(workspace=tmp_path, env=env, command=("/bin/sh",))

    assert fake_resource.prlimit_calls == [
        (2222, fake_resource.RLIMIT_CPU, (7, 7)),
        (2222, fake_resource.RLIMIT_DATA, (2048, 2048)),
    ]

Domain

Subdomains

Frequently Asked Questions

What does test_host_policy_falls_back_to_rlimit_data() do?
test_host_policy_falls_back_to_rlimit_data() 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_falls_back_to_rlimit_data() defined?
test_host_policy_falls_back_to_rlimit_data() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py at line 166.
What does test_host_policy_falls_back_to_rlimit_data() call?
test_host_policy_falls_back_to_rlimit_data() 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