diff --git a/tests/components/google_assistant/test_http.py b/tests/components/google_assistant/test_http.py index b041f69828f..273aac1559e 100644 --- a/tests/components/google_assistant/test_http.py +++ b/tests/components/google_assistant/test_http.py @@ -4,6 +4,7 @@ from datetime import UTC, datetime, timedelta from http import HTTPStatus import json import os +from pathlib import Path from typing import Any from unittest.mock import ANY, patch from uuid import uuid4 @@ -655,9 +656,7 @@ async def test_async_get_users( ) path = hass.config.config_dir / ".storage" / GoogleConfigStore._STORAGE_KEY os.makedirs(os.path.dirname(path), exist_ok=True) - with open(path, "w", encoding="utf8") as f: - f.write(store_data) - + await hass.async_add_executor_job(Path(path).write_text, store_data) assert await async_get_users(hass) == expected_users await hass.async_stop()