Home / Function/ test_docker_policy_skips_mount_for_temp_workspace() — langchain Function Reference

test_docker_policy_skips_mount_for_temp_workspace() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  6d2a7490_cf44_bbe1_0f97_f0a8d2a67636["test_docker_policy_skips_mount_for_temp_workspace()"]
  6b16168d_9880_7f41_060c_9fcd5b337996["test_shell_execution_policies.py"]
  6d2a7490_cf44_bbe1_0f97_f0a8d2a67636 -->|defined in| 6b16168d_9880_7f41_060c_9fcd5b337996
  style 6d2a7490_cf44_bbe1_0f97_f0a8d2a67636 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 342–370

def test_docker_policy_skips_mount_for_temp_workspace(
    monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
    monkeypatch.setattr(shutil, "which", lambda _: "/usr/bin/docker")

    recorded: dict[str, list[str]] = {}

    def fake_launch(command: Sequence[str], *, cwd: Path, **_kwargs: Any) -> subprocess.Popen[str]:
        recorded["command"] = list(command)
        assert cwd == workspace
        return Mock()

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

    workspace = tmp_path / f"{_execution.SHELL_TEMP_PREFIX}case"
    workspace.mkdir()
    policy = DockerExecutionPolicy(cpus="1.5")
    env = {"PATH": "/bin"}
    policy.spawn(workspace=workspace, env=env, command=("/bin/sh",))

    command = recorded["command"]
    assert "-v" not in command
    assert "-w" in command
    w_index = command.index("-w")
    assert command[w_index + 1] == "/"
    assert "--cpus" in command
    assert "--network" in command
    assert "none" in command
    assert command[-2:] == [policy.image, "/bin/sh"]

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free