@@ -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
@@ -108,7 +108,7 @@ def test_configure_api_key_with_store(self):
108108 mock_client_class .return_value .__enter__ .return_value = mock_client
109109
110110 with (
111- patch ("builtins .open" , mock_open ()) as mock_file ,
111+ patch ("pathlib.Path .open" , mock_open ()) as mock_file ,
112112 patch ("pathlib.Path.mkdir" ),
113113 ):
114114 config = Configuration ()
@@ -147,7 +147,7 @@ def test_load_api_key_no_file(self):
147147 def test_load_api_key_invalid_yaml (self ):
148148 """Test loading API key with invalid YAML."""
149149 with (
150- patch ("builtins .open" , mock_open (read_data = "invalid: yaml: content:" )),
150+ patch ("pathlib.Path .open" , mock_open (read_data = "invalid: yaml: content:" )),
151151 patch ("pathlib.Path.exists" , return_value = True ),
152152 patch .dict (os .environ , {}, clear = True ),
153153 ):
@@ -159,7 +159,7 @@ def test_config_file_location(self):
159159 """Test that configuration is loaded from the correct location."""
160160 with (
161161 patch ("pathlib.Path.exists" ) as mock_exists ,
162- patch ("builtins .open" , mock_open (read_data = "api_key: test-key" )),
162+ patch ("pathlib.Path .open" , mock_open (read_data = "api_key: test-key" )),
163163 patch .dict (os .environ , {}, clear = True ),
164164 ):
165165 # Initialize config which should try to load from file
0 commit comments