Skip to content

Commit 6f6c925

Browse files
committed
fix(lint): remove unused imports, fix E701 inline-if in test_snmp_collector
Resolves ruff failures on CI: - Remove unused imports: json, call, pytest, _http_get_json, _http_post_json - Expand inline if/return to multi-line (E701) - Remove unused variable if_mac in test_interface_down_status (F841) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AbfhpQR6qzZAXcTacEcZvn
1 parent 502c6df commit 6f6c925

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

tests/test_snmp_collector.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
"""
77
from __future__ import annotations
88

9-
import json
109
import sys
1110
import types
12-
from unittest.mock import MagicMock, patch, call
13-
14-
import pytest
11+
from unittest.mock import MagicMock, patch
1512

1613
# ---------------------------------------------------------------------------
1714
# Synthetic pysnmp stub so the import inside snmp_collector doesn't fail
@@ -68,8 +65,6 @@ def _make_pysnmp_stub() -> types.ModuleType:
6865
_poll_device,
6966
_vendor_from_sysoid,
7067
_extract_model_from_descr,
71-
_http_get_json,
72-
_http_post_json,
7368
OID_IF_DESCR,
7469
OID_IF_OPER_STATUS,
7570
OID_IF_PHY_ADDRESS,
@@ -222,9 +217,12 @@ def test_interfaces_parsed_from_walk(self):
222217
session.get.return_value = sys_data
223218

224219
def walk_side(oid):
225-
if oid == OID_IF_DESCR: return if_descr
226-
if oid == OID_IF_OPER_STATUS: return if_oper
227-
if oid == OID_IF_PHY_ADDRESS: return if_mac
220+
if oid == OID_IF_DESCR:
221+
return if_descr
222+
if oid == OID_IF_OPER_STATUS:
223+
return if_oper
224+
if oid == OID_IF_PHY_ADDRESS:
225+
return if_mac
228226
return {}
229227

230228
session.walk.side_effect = walk_side
@@ -240,15 +238,16 @@ def test_interface_down_status(self):
240238
sys_data = {".1.3.6.1.2.1.1.5.0": "sw"}
241239
if_descr = {".1.3.6.1.2.1.2.2.1.2.2": "Ethernet0/1"}
242240
if_oper = {".1.3.6.1.2.1.2.2.1.8.2": "2"} # down
243-
if_mac = {}
244241

245242
session = MagicMock(spec=_SNMPSession)
246243
session.available = True
247244
session.get.return_value = sys_data
248245

249246
def walk_side(oid):
250-
if oid == OID_IF_DESCR: return if_descr
251-
if oid == OID_IF_OPER_STATUS: return if_oper
247+
if oid == OID_IF_DESCR:
248+
return if_descr
249+
if oid == OID_IF_OPER_STATUS:
250+
return if_oper
252251
return {}
253252
session.walk.side_effect = walk_side
254253

0 commit comments

Comments
 (0)