Use contextlib.suppress where possible (#48189)

This commit is contained in:
Franck Nijhof 2021-03-23 14:36:43 +01:00 committed by GitHub
parent 9656f260a4
commit 6932cf9534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 238 additions and 398 deletions

View file

@ -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