Fix Path.__enter__ DeprecationWarning in tests (#125227)

This commit is contained in:
Marc Mueller 2024-09-04 16:12:57 +02:00 committed by GitHub
parent 1e1c3506fe
commit 3a44098ddf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,9 +54,11 @@ def mock_process_uploaded_file(
create_google_credentials_json: str,
) -> Generator[MagicMock]:
"""Mock upload certificate files."""
ctx_mock = MagicMock()
ctx_mock.__enter__.return_value = Path(create_google_credentials_json)
with patch(
"homeassistant.components.google_cloud.config_flow.process_uploaded_file",
return_value=Path(create_google_credentials_json),
return_value=ctx_mock,
) as mock_upload:
yield mock_upload