Use contextlib.suppress where possible (#48189)
This commit is contained in:
parent
9656f260a4
commit
6932cf9534
86 changed files with 238 additions and 398 deletions
|
@ -1,5 +1,6 @@
|
|||
"""The tests for generic camera component."""
|
||||
import asyncio
|
||||
from contextlib import suppress
|
||||
|
||||
from aiohttp.client_exceptions import ClientResponseError
|
||||
|
||||
|
@ -214,10 +215,8 @@ async def test_retries_after_error(aioclient_mock, hass, hass_client):
|
|||
aioclient_mock.get(radar_map_url(), text=None, status=HTTP_INTERNAL_SERVER_ERROR)
|
||||
|
||||
# A 404 should not return data and throw:
|
||||
try:
|
||||
with suppress(ClientResponseError):
|
||||
await client.get("/api/camera_proxy/camera.config_test")
|
||||
except ClientResponseError:
|
||||
pass
|
||||
|
||||
assert aioclient_mock.call_count == 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue