Use the new factory pattern for ToolManager injection.
(monkeypatch)
| 112 | # --------------------------------------------------------------------------- # |
| 113 | @pytest.fixture(autouse=True) |
| 114 | def patch_tool_manager(monkeypatch): |
| 115 | """Use the new factory pattern for ToolManager injection.""" |
| 116 | from mcp_cli.run_command import set_tool_manager_factory |
| 117 | |
| 118 | # Set the factory to use DummyToolManager |
| 119 | set_tool_manager_factory(DummyToolManager) |
| 120 | |
| 121 | # Also patch the direct import for backward compatibility |
| 122 | monkeypatch.setattr( |
| 123 | "mcp_cli.tools.manager.ToolManager", DummyToolManager, raising=True |
| 124 | ) |
| 125 | |
| 126 | # Clean collected list between tests |
| 127 | _ALL_TM.clear() |
| 128 | yield |
| 129 | _ALL_TM.clear() |
| 130 | |
| 131 | # Reset the factory after test |
| 132 | set_tool_manager_factory(None) |
| 133 | |
| 134 | |
| 135 | # --------------------------------------------------------------------------- # |
nothing calls this directly
no test coverage detected