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

Functions

Path tmp_project_root (Path tmp_path)
McpConfig default_config ()
MagicMock mock_sandbox ()
ToolExecutor mock_executor (MagicMock mock_sandbox)
Redactor default_redactor ()
McpAuditLogger mcp_audit_logger (Path tmp_path)
McpPolicy default_policy ()
McpMetrics isolated_metrics ()
ServerState server_state (Path tmp_project_root, McpConfig default_config, McpPolicy default_policy, ToolExecutor mock_executor, Redactor default_redactor, McpAuditLogger mcp_audit_logger, McpMetrics isolated_metrics)

Detailed Description

Purpose
-------
Shared fixtures for the oct-mcp test suite.

Responsibilities
----------------
- Provide ``tmp_project_root`` with minimal project skeleton.
- Provide pre-configured instances of ``McpConfig``, ``McpPolicy``,
  ``SafetyGate``, ``Redactor``, ``McpMetrics``, ``McpAuditLogger``,
  ``SandboxExecutor``, ``ToolExecutor``, and ``ServerState``.

Diagnostics
-----------
Domain: MCP-TESTS
L2: fixture lifecycle
L3: fixture details
L4: deep tracing

Contracts
---------
- All project roots use ``tmp_path``; no real project files are touched.

Function Documentation

◆ default_config()

McpConfig tests_mcp.conftest.default_config ( )
A default McpConfig with safe defaults.

Definition at line 59 of file conftest.py.

◆ default_policy()

McpPolicy tests_mcp.conftest.default_policy ( )
A McpPolicy in 'default' profile with safe_mode=False.

Definition at line 95 of file conftest.py.

◆ default_redactor()

Redactor tests_mcp.conftest.default_redactor ( )
A Redactor with no custom patterns.

Definition at line 83 of file conftest.py.

◆ isolated_metrics()

McpMetrics tests_mcp.conftest.isolated_metrics ( )
An :class:`McpMetrics` backed by a private ``CollectorRegistry``.

Prevents ``Duplicated timeseries in CollectorRegistry`` collisions
when multiple tests instantiate ``McpMetrics`` in the same process
and ``prometheus_client`` is installed. When ``prometheus_client`` is
absent, returns the default no-op stub (the ``registry`` argument is
inert in that case).

Definition at line 101 of file conftest.py.

◆ mcp_audit_logger()

McpAuditLogger tests_mcp.conftest.mcp_audit_logger ( Path tmp_path)
An McpAuditLogger writing to a temp directory.

Definition at line 89 of file conftest.py.

◆ mock_executor()

ToolExecutor tests_mcp.conftest.mock_executor ( MagicMock mock_sandbox)
A ToolExecutor backed by the mock sandbox.

Definition at line 77 of file conftest.py.

◆ mock_sandbox()

MagicMock tests_mcp.conftest.mock_sandbox ( )
A mock SandboxExecutor that returns a success result.

Definition at line 65 of file conftest.py.

◆ server_state()

ServerState tests_mcp.conftest.server_state ( Path tmp_project_root,
McpConfig default_config,
McpPolicy default_policy,
ToolExecutor mock_executor,
Redactor default_redactor,
McpAuditLogger mcp_audit_logger,
McpMetrics isolated_metrics )
A fully wired ServerState for integration tests.

Definition at line 118 of file conftest.py.

◆ tmp_project_root()

Path tests_mcp.conftest.tmp_project_root ( Path tmp_path)
A minimal Option C project root in a temp directory.

Definition at line 49 of file conftest.py.