test_startup_and_shutdown_commands() — langchain Function Reference
Architecture documentation for the test_startup_and_shutdown_commands() function in test_shell_tool.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD cf4a1b72_8d63_f795_52b9_b97bf37a9567["test_startup_and_shutdown_commands()"] f21fd460_1d0c_cb92_cfa1_eae0890e2f58["test_shell_tool.py"] cf4a1b72_8d63_f795_52b9_b97bf37a9567 -->|defined in| f21fd460_1d0c_cb92_cfa1_eae0890e2f58 1bc202d6_8b54_02e9_fadd_ff3171c38a75["_empty_state()"] cf4a1b72_8d63_f795_52b9_b97bf37a9567 -->|calls| 1bc202d6_8b54_02e9_fadd_ff3171c38a75 style cf4a1b72_8d63_f795_52b9_b97bf37a9567 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py lines 133–149
def test_startup_and_shutdown_commands(tmp_path: Path) -> None:
workspace = tmp_path / "workspace"
middleware = ShellToolMiddleware(
workspace_root=workspace,
startup_commands=("touch startup.txt",),
shutdown_commands=("touch shutdown.txt",),
)
runtime = Runtime()
state = _empty_state()
try:
updates = middleware.before_agent(state, runtime)
if updates:
state.update(cast("ShellToolState", updates))
assert (workspace / "startup.txt").exists()
finally:
middleware.after_agent(state, runtime)
assert (workspace / "shutdown.txt").exists()
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_startup_and_shutdown_commands() do?
test_startup_and_shutdown_commands() 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_startup_and_shutdown_commands() defined?
test_startup_and_shutdown_commands() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_shell_tool.py at line 133.
What does test_startup_and_shutdown_commands() call?
test_startup_and_shutdown_commands() 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