mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix uncaught exception in local_file (#34312)
* remove ignore from localfile * added mock_registry * since there are no more exceptions, infra to ignore them is redundant
This commit is contained in:
parent
a2b280f342
commit
1259979204
@ -41,6 +41,8 @@ async def test_loading_file(hass, hass_client):
|
||||
|
||||
async def test_file_not_readable(hass, caplog):
|
||||
"""Test a warning is shown setup when file is not readable."""
|
||||
mock_registry(hass)
|
||||
|
||||
with mock.patch("os.path.isfile", mock.Mock(return_value=True)), mock.patch(
|
||||
"os.access", mock.Mock(return_value=False)
|
||||
):
|
||||
|
@ -19,11 +19,6 @@ from homeassistant.exceptions import ServiceNotFound
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import location
|
||||
|
||||
from tests.ignore_uncaught_exceptions import (
|
||||
IGNORE_UNCAUGHT_EXCEPTIONS,
|
||||
IGNORE_UNCAUGHT_JSON_EXCEPTIONS,
|
||||
)
|
||||
|
||||
pytest.register_assert_rewrite("tests.common")
|
||||
|
||||
from tests.common import ( # noqa: E402, isort:skip
|
||||
@ -100,20 +95,8 @@ def hass(loop, hass_storage, request):
|
||||
|
||||
loop.run_until_complete(hass.async_stop(force=True))
|
||||
for ex in exceptions:
|
||||
if (
|
||||
request.module.__name__,
|
||||
request.function.__name__,
|
||||
) in IGNORE_UNCAUGHT_EXCEPTIONS:
|
||||
continue
|
||||
if isinstance(ex, ServiceNotFound):
|
||||
continue
|
||||
if (
|
||||
isinstance(ex, TypeError)
|
||||
and "is not JSON serializable" in str(ex)
|
||||
and (request.module.__name__, request.function.__name__)
|
||||
in IGNORE_UNCAUGHT_JSON_EXCEPTIONS
|
||||
):
|
||||
continue
|
||||
raise ex
|
||||
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
"""List of modules that have uncaught exceptions today. Will be shrunk over time."""
|
||||
IGNORE_UNCAUGHT_EXCEPTIONS = [
|
||||
("tests.components.local_file.test_camera", "test_file_not_readable"),
|
||||
]
|
||||
|
||||
IGNORE_UNCAUGHT_JSON_EXCEPTIONS = []
|
Loading…
x
Reference in New Issue
Block a user