Skip to content

Commit

Permalink
style: better function name with overwrite_config_context
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebergman committed Oct 16, 2024
1 parent 2f02078 commit 0bbd67d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openml/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def set_root_cache_directory(root_cache_directory: str | Path) -> None:


@contextmanager
def set_context(config: dict[str, Any]) -> Iterator[_Config]:
def overwrite_config_context(config: dict[str, Any]) -> Iterator[_Config]:
"""A context manager to temporarily override variables in the configuration."""
existing_config = get_config_as_dict()
merged_config = {**existing_config, **config}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_openml/test_api_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def test_authentication_endpoints_requiring_api_key_show_relevant_help_link(
method: str,
) -> None:
# We need to temporarily disable the API key to test the error message
with openml.config.set_context({"apikey": None}):
with openml.config.overwrite_config_context({"apikey": None}):
with pytest.raises(openml.exceptions.OpenMLNotAuthorizedError, match=API_TOKEN_HELP_LINK):
openml._api_calls._perform_api_call(call=endpoint, request_method=method, data=None)

0 comments on commit 0bbd67d

Please sign in to comment.