Skip to content

Commit

Permalink
fix linting SIM105
Browse files Browse the repository at this point in the history
  • Loading branch information
lbbrhzn committed Sep 8, 2024
1 parent 136afcd commit e5b6a5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ lint.select = [
"ICN001", # import concentions; {name} should be imported as {asname}
"PGH004", # Use specific rule codes when using noqa
"PLC0414", # Useless import alias. Import alias does not rename original package.
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM117", # Merge with-statements that use the same scope
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys()
"SIM201", # Use {left} != {right} instead of not {left} == {right}
Expand All @@ -26,7 +27,6 @@ lint.select = [
]

lint.ignore = [
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"C901", # function too complex
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
Expand Down
12 changes: 3 additions & 9 deletions tests/test_charge_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ async def test_services(hass, socket_enabled):
) as ws:
# use a different id for debugging
cp = ChargePoint("CP_1_normal", ws)
try:
with contextlib.suppress(asyncio.TimeoutError):
await asyncio.wait_for(
asyncio.gather(
cp.start(),
Expand All @@ -332,8 +332,6 @@ async def test_services(hass, socket_enabled):
),
timeout=5,
)
except asyncio.TimeoutError:
pass
await ws.close()
assert int(cs.get_metric("test_cpid", "Energy.Active.Import.Register")) == int(
1305570 / 1000
Expand Down Expand Up @@ -401,7 +399,7 @@ async def test_services(hass, socket_enabled):
) as ws:
# use a different id for debugging
cp = ChargePoint("CP_1_non_errata_3.9", ws)
try:
with contextlib.suppress(asyncio.TimeoutError):
await asyncio.wait_for(
asyncio.gather(
cp.start(),
Expand All @@ -413,8 +411,6 @@ async def test_services(hass, socket_enabled):
),
timeout=5,
)
except asyncio.TimeoutError:
pass
await ws.close()

# Last sent "Energy.Active.Import.Register" value without transaction id should be here.
Expand All @@ -436,7 +432,7 @@ async def test_services(hass, socket_enabled):
) as ws:
# use a different id for debugging
cp = ChargePoint("CP_1_non_errata_3.9", ws)
try:
with contextlib.suppress(asyncio.TimeoutError):
await asyncio.wait_for(
asyncio.gather(
cp.start(),
Expand All @@ -448,8 +444,6 @@ async def test_services(hass, socket_enabled):
),
timeout=5,
)
except asyncio.TimeoutError:
pass
await ws.close()

assert int(cs.get_metric("test_cpid", "Energy.Active.Import.Register")) == 1101
Expand Down

0 comments on commit e5b6a5e

Please sign in to comment.