Clean up: drop unused imports, tighten test exception assert
- Remove unused utcnow / HopEdge imports (F401). - Assert DeviceCommandError instead of bare Exception in the admin-login test (B017). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c75a2eb2e3
commit
9a308096f0
3 files changed
+3
-4
No files matched your search
@@ -18,7 +18,7 @@ import random
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from .models import Contact, Hop, TraceResult, utcnow
|
||||
from .models import Contact, Hop, TraceResult
|
||||
|
||||
TX_POWER_MIN = 1
|
||||
TX_POWER_MAX = 22
|
||||
|
||||
@@ -22,7 +22,6 @@ from ..core.models import (
|
||||
LOCAL_DEVICE_LABEL,
|
||||
Contact,
|
||||
HopAggregate,
|
||||
HopEdge,
|
||||
TraceResult,
|
||||
TraceStats,
|
||||
TxOptResult,
|
||||
|
||||
@@ -9,7 +9,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from meshtools.core.connection import MockDevice, clamp_tx_power
|
||||
from meshtools.core.connection import DeviceCommandError, MockDevice, clamp_tx_power
|
||||
from meshtools.core.models import Contact, TraceResult, TraceStats
|
||||
from meshtools.persistence.repository import Repository
|
||||
from meshtools.services import trace_runner
|
||||
@@ -274,7 +274,7 @@ async def test_admin_login_rejects_wrong_password() -> None:
|
||||
admin = (await device.get_contacts())[0]
|
||||
|
||||
assert await device.admin_login(admin, "nope") is False
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(DeviceCommandError):
|
||||
await device.set_remote_tx_power(admin, 18) # not logged in
|
||||
assert await device.admin_login(admin, "secret") is True
|
||||
await device.set_remote_tx_power(admin, 18) # now allowed
|
||||
|
||||
Reference in new issue
Block a user