test_docker_policy_read_only_and_user() — langchain Function Reference
Architecture documentation for the test_docker_policy_read_only_and_user() function in test_shell_execution_policies.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 97f56baf_c4a3_1d19_89d0_fc4b0e430471["test_docker_policy_read_only_and_user()"] 6b16168d_9880_7f41_060c_9fcd5b337996["test_shell_execution_policies.py"] 97f56baf_c4a3_1d19_89d0_fc4b0e430471 -->|defined in| 6b16168d_9880_7f41_060c_9fcd5b337996 style 97f56baf_c4a3_1d19_89d0_fc4b0e430471 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 383–402
def test_docker_policy_read_only_and_user(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], **_kwargs: Any) -> subprocess.Popen[str]:
recorded["command"] = list(command)
return Mock()
monkeypatch.setattr(_execution, "_launch_subprocess", fake_launch)
workspace = tmp_path
policy = DockerExecutionPolicy(read_only_rootfs=True, user="1000:1000")
policy.spawn(workspace=workspace, env={"PATH": "/bin"}, command=("/bin/sh",))
command = recorded["command"]
assert "--read-only" in command
assert "--user" in command
user_index = command.index("--user")
assert command[user_index + 1] == "1000:1000"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_docker_policy_read_only_and_user() do?
test_docker_policy_read_only_and_user() 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_read_only_and_user() defined?
test_docker_policy_read_only_and_user() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_execution_policies.py at line 383.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free