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
3 changed files with 2 additions and 23 deletions
|
@ -41,6 +41,8 @@ async def test_loading_file(hass, hass_client):
|
||||||
|
|
||||||
async def test_file_not_readable(hass, caplog):
|
async def test_file_not_readable(hass, caplog):
|
||||||
"""Test a warning is shown setup when file is not readable."""
|
"""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(
|
with mock.patch("os.path.isfile", mock.Mock(return_value=True)), mock.patch(
|
||||||
"os.access", mock.Mock(return_value=False)
|
"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.setup import async_setup_component
|
||||||
from homeassistant.util import location
|
from homeassistant.util import location
|
||||||
|
|
||||||
from tests.ignore_uncaught_exceptions import (
|
|
||||||
IGNORE_UNCAUGHT_EXCEPTIONS,
|
|
||||||
IGNORE_UNCAUGHT_JSON_EXCEPTIONS,
|
|
||||||
)
|
|
||||||
|
|
||||||
pytest.register_assert_rewrite("tests.common")
|
pytest.register_assert_rewrite("tests.common")
|
||||||
|
|
||||||
from tests.common import ( # noqa: E402, isort:skip
|
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))
|
loop.run_until_complete(hass.async_stop(force=True))
|
||||||
for ex in exceptions:
|
for ex in exceptions:
|
||||||
if (
|
|
||||||
request.module.__name__,
|
|
||||||
request.function.__name__,
|
|
||||||
) in IGNORE_UNCAUGHT_EXCEPTIONS:
|
|
||||||
continue
|
|
||||||
if isinstance(ex, ServiceNotFound):
|
if isinstance(ex, ServiceNotFound):
|
||||||
continue
|
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
|
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…
Add table
Add a link
Reference in a new issue