MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_config_singleton_pattern

Function test_config_singleton_pattern

tests/utils/test_config.py:104–121  ·  view source on GitHub ↗

Test that config manager follows singleton pattern.

(tmp_path)

Source from the content-addressed store, hash-verified

102
103@pytest.mark.asyncio
104async def test_config_singleton_pattern(tmp_path):
105 """Test that config manager follows singleton pattern."""
106 config_data = {"mcpServers": {"Server1": {"command": "cmd1"}}}
107 config_file = tmp_path / "config.json"
108 config_file.write_text(json.dumps(config_data))
109
110 # Reset the singleton first
111 ConfigManager._instance = None
112
113 # Initialize config
114 config1 = initialize_config(config_file)
115
116 # Get config should return the same instance
117 config2 = get_config()
118
119 # Should be the same object
120 assert config1 is config2
121 assert config1.servers == config2.servers

Callers

nothing calls this directly

Calls 2

initialize_configFunction · 0.90
get_configFunction · 0.90

Tested by

no test coverage detected