@@ -39,8 +39,9 @@ def test_config_from_file(self):
3939 temp_file_path = temp_file .name
4040
4141 try :
42- # Load config from the file
43- config = Config .from_file (temp_file_path )
42+ # Load config from the file using SHS_MCP_CONFIG env var
43+ with patch .dict (os .environ , {"SHS_MCP_CONFIG" : temp_file_path }):
44+ config = Config ()
4445
4546 # Verify the loaded configuration
4647 self .assertEqual (config .mcp .address , "test_host" )
@@ -63,9 +64,10 @@ def test_config_from_file(self):
6364 os .unlink (temp_file_path )
6465
6566 def test_nonexistent_config_file (self ):
66- """Test behavior when config file doesn't exist."""
67+ """Test behavior when explicitly specified config file doesn't exist."""
6768 with self .assertRaises (FileNotFoundError ):
68- Config .from_file ("nonexistent_file.yaml" )
69+ with patch .dict (os .environ , {"SHS_MCP_CONFIG" : "nonexistent_file.yaml" }):
70+ Config ()
6971
7072 @patch .dict (
7173 os .environ ,
@@ -89,7 +91,8 @@ def test_config_from_env_vars(self):
8991 temp_file_path = temp_file .name
9092
9193 try :
92- config = Config .from_file (temp_file_path )
94+ with patch .dict (os .environ , {"SHS_MCP_CONFIG" : temp_file_path }):
95+ config = Config ()
9396
9497 # Verify MCP config from env vars
9598 self .assertEqual (config .mcp .address , "env_host" )
@@ -122,7 +125,8 @@ def test_env_vars_override_file_config(self):
122125 temp_file_path = temp_file .name
123126
124127 try :
125- config = Config .from_file (temp_file_path )
128+ with patch .dict (os .environ , {"SHS_MCP_CONFIG" : temp_file_path }):
129+ config = Config ()
126130
127131 # Verify that env vars override file config
128132 self .assertEqual (config .mcp .address , "override_host" )
@@ -147,7 +151,8 @@ def test_default_values(self):
147151 temp_file_path = temp_file .name
148152
149153 try :
150- config = Config .from_file (temp_file_path )
154+ with patch .dict (os .environ , {"SHS_MCP_CONFIG" : temp_file_path }):
155+ config = Config ()
151156
152157 # Check MCP defaults
153158 self .assertEqual (config .mcp .address , "localhost" )
0 commit comments