Home / Function/ test_timeout_returns_error() — langchain Function Reference

test_timeout_returns_error() — langchain Function Reference

Architecture documentation for the test_timeout_returns_error() function in test_shell_tool.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3705c4c5_c468_1a63_c8a7_e783d4c9e763["test_timeout_returns_error()"]
  f21fd460_1d0c_cb92_cfa1_eae0890e2f58["test_shell_tool.py"]
  3705c4c5_c468_1a63_c8a7_e783d4c9e763 -->|defined in| f21fd460_1d0c_cb92_cfa1_eae0890e2f58
  1bc202d6_8b54_02e9_fadd_ff3171c38a75["_empty_state()"]
  3705c4c5_c468_1a63_c8a7_e783d4c9e763 -->|calls| 1bc202d6_8b54_02e9_fadd_ff3171c38a75
  style 3705c4c5_c468_1a63_c8a7_e783d4c9e763 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py lines 91–107

def test_timeout_returns_error(tmp_path: Path) -> None:
    policy = HostExecutionPolicy(command_timeout=0.5)
    middleware = ShellToolMiddleware(workspace_root=tmp_path / "workspace", execution_policy=policy)
    runtime = Runtime()
    state = _empty_state()
    try:
        updates = middleware.before_agent(state, runtime)
        if updates:
            state.update(cast("ShellToolState", updates))
        resources = middleware._get_or_create_resources(state)
        start = time.monotonic()
        result = middleware._run_shell_tool(resources, {"command": "sleep 2"}, tool_call_id=None)
        elapsed = time.monotonic() - start
        assert elapsed < policy.command_timeout + 2.0
        assert "timed out" in result.lower()
    finally:
        middleware.after_agent(state, runtime)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free