Fix androidtv isfile patcher in tests (#146696)

This commit is contained in:
Marc Mueller 2025-06-13 16:25:09 +02:00 committed by GitHub
parent ff17d79e73
commit 038a848d53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
"""Define patches used for androidtv tests."""
import os.path
from typing import Any
from unittest.mock import patch
@ -12,6 +13,8 @@ from homeassistant.components.androidtv.const import (
DEVICE_FIRETV,
)
_original_isfile = os.path.isfile
ADB_SERVER_HOST = "127.0.0.1"
KEY_PYTHON = "python"
KEY_SERVER = "server"
@ -185,7 +188,9 @@ def patch_androidtv_update(
def isfile(filepath):
"""Mock `os.path.isfile`."""
return filepath.endswith("adbkey")
if str(filepath).endswith("adbkey"):
return True
return _original_isfile(filepath)
PATCH_SCREENCAP = patch(