Option C Tools
Loading...
Searching...
No Matches
tests_mcp.test_mcp_sandbox_backends Namespace Reference

Classes

class  TestSandboxBackendProtocol
class  TestNativeBackend
class  TestBubblewrapBackend
class  TestSandboxExecBackend
class  TestMakeSandboxBackend
class  TestSandboxExecutorDelegation
class  TestSanitiseEnv

Functions

object _fake_config (str sandbox_backend="auto", int memory_limit_mb=0)

Detailed Description

Purpose
-------
Phase 5C tests for pluggable sandbox backends (``NativeBackend``,
``BubblewrapBackend``, ``SandboxExecBackend``) and the
``make_sandbox_backend`` factory.

Responsibilities
----------------
- Verify ``NativeBackend.run()`` returns correctly and passes sanitised
  env.
- Verify ``BubblewrapBackend`` and ``SandboxExecBackend`` command
  structure.
- Verify ``make_sandbox_backend`` factory for all backend names and
  auto-detection per platform.
- Verify ``SandboxExecutor`` delegation, memory-limit conversion, output
  capping, and error handling (timeout, OSError, FileNotFoundError).
- Verify ``_sanitise_env`` strips sensitive variables and adds
  ``OCT_MCP_CWD``.

Diagnostics
-----------
Domain: MCP-TESTS
Levels:
    L2 — test lifecycle
    L3 — assertion details
    L4 — deep tracing

Contracts
---------
- Tests use mock subprocess and platform stubs; no real sandbox commands
  are executed.

Function Documentation

◆ _fake_config()

object tests_mcp.test_mcp_sandbox_backends._fake_config ( str sandbox_backend = "auto",
int memory_limit_mb = 0 )
protected
Minimal stand-in for McpConfig.

Definition at line 64 of file test_mcp_sandbox_backends.py.

Here is the caller graph for this function: