@@ -31,7 +31,7 @@ def test_init_with_config_file(self):
3131
3232 with (
3333 patch .dict (os .environ , {"BG_API_KEY" : "" }), # Clear env var
34- patch ("builtins .open" , mock_open (read_data = yaml .dump (mock_yaml_data ))),
34+ patch ("pathlib.Path .open" , mock_open (read_data = yaml .dump (mock_yaml_data ))),
3535 patch ("pathlib.Path.exists" , return_value = True ),
3636 ):
3737 config = Configuration ()
@@ -43,7 +43,7 @@ def test_init_priority_order(self):
4343
4444 with (
4545 patch .dict (os .environ , {"BG_API_KEY" : "env-key" }),
46- patch ("builtins .open" , mock_open (read_data = yaml .dump (mock_yaml_data ))),
46+ patch ("pathlib.Path .open" , mock_open (read_data = yaml .dump (mock_yaml_data ))),
4747 patch ("pathlib.Path.exists" , return_value = True ),
4848 ):
4949 # Direct API key takes precedence
@@ -101,7 +101,7 @@ def test_configure_api_key_with_store(self):
101101 mock_client_class .return_value .__enter__ .return_value = mock_client
102102
103103 with (
104- patch ("builtins .open" , mock_open ()) as mock_file ,
104+ patch ("pathlib.Path .open" , mock_open ()) as mock_file ,
105105 patch ("pathlib.Path.mkdir" ),
106106 ):
107107 config = Configuration ()
@@ -140,7 +140,7 @@ def test_load_api_key_no_file(self):
140140 def test_load_api_key_invalid_yaml (self ):
141141 """Test loading API key with invalid YAML."""
142142 with (
143- patch ("builtins .open" , mock_open (read_data = "invalid: yaml: content:" )),
143+ patch ("pathlib.Path .open" , mock_open (read_data = "invalid: yaml: content:" )),
144144 patch ("pathlib.Path.exists" , return_value = True ),
145145 patch .dict (os .environ , {}, clear = True ),
146146 ):
@@ -152,7 +152,7 @@ def test_config_file_location(self):
152152 """Test that configuration is loaded from the correct location."""
153153 with (
154154 patch ("pathlib.Path.exists" ) as mock_exists ,
155- patch ("builtins .open" , mock_open (read_data = "api_key: test-key" )),
155+ patch ("pathlib.Path .open" , mock_open (read_data = "api_key: test-key" )),
156156 patch .dict (os .environ , {}, clear = True ),
157157 ):
158158 # Initialize config which should try to load from file
0 commit comments