Merge pull request #51 from zvx-echo6/chore/lint-cleanup-test-imports

chore(lint-cleanup): remove 10 pre-existing ruff issues in 4 test files
This commit is contained in:
malice 2026-05-21 12:21:05 -06:00 committed by GitHub
commit d0375225b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 25 deletions

View file

@ -5,7 +5,7 @@ import base64
import os
from datetime import datetime, timedelta, timezone
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
from unittest.mock import MagicMock
import asyncpg
import pytest
@ -206,10 +206,7 @@ class TestRateLimitGuarantee:
state.config = new_config
state.adapter.cadence_s = 90
# Calculate expected next poll time
expected_next_poll = last_poll + timedelta(seconds=90)
now = datetime.now(timezone.utc)
expected_wait = max(0, (expected_next_poll - now).total_seconds())
# The wait time should be based on last_poll + new_cadence
# Since last_poll was 30 seconds ago and new cadence is 90,
@ -230,7 +227,6 @@ class TestRateLimitGuarantee:
If operator increases cadence to 120s after a gap of 150s,
the poll should happen now (not wait another 120s).
"""
from central.supervisor import AdapterState
mock_adapter = MagicMock()
mock_adapter.name = "test"
@ -248,13 +244,6 @@ class TestRateLimitGuarantee:
updated_at=datetime.now(timezone.utc),
)
state = AdapterState(
name="test",
adapter=mock_adapter,
config=config,
last_completed_poll=last_poll,
)
# Calculate next poll time
now = datetime.now(timezone.utc)
next_poll_at = last_poll.timestamp() + config.cadence_s
@ -274,7 +263,6 @@ class TestRateLimitGuarantee:
poll should be at (last_completed_poll + cadence_s), not immediately
(unless that time has already passed).
"""
from central.supervisor import AdapterState
mock_adapter = MagicMock()
mock_adapter.name = "test"
@ -293,13 +281,6 @@ class TestRateLimitGuarantee:
updated_at=datetime.now(timezone.utc),
)
state = AdapterState(
name="test",
adapter=mock_adapter,
config=config,
last_completed_poll=last_poll,
)
# Calculate next poll time
now = datetime.now(timezone.utc)
next_poll_at = last_poll.timestamp() + config.cadence_s

View file

@ -9,15 +9,13 @@ IMPORTANT: These tests are designed to:
- PASS on fixed code (last_completed_poll is preserved across disable/enable)
"""
import asyncio
import base64
import os
from datetime import datetime, timedelta, timezone
from pathlib import Path
from unittest.mock import AsyncMock, MagicMock, patch
from unittest.mock import AsyncMock, MagicMock
import pytest
import pytest_asyncio
from central.config_models import AdapterConfig
from central.bootstrap_config import get_settings
@ -195,7 +193,7 @@ class TestEnableDisableEnableIntegration:
- Assert next poll fires immediately (last+cadence is in past)
- Assert exactly ONE poll happens, not multiple catch-up
"""
from central.supervisor import Supervisor, AdapterState
from central.supervisor import Supervisor
config_source = MockConfigSource()
initial_config = AdapterConfig(
@ -306,7 +304,7 @@ class TestEnableDisableEnableIntegration:
- Re-enable adapter 20 seconds later (still within cadence window)
- Assert next poll fires at last_poll + 60s, NOT immediately
"""
from central.supervisor import Supervisor, AdapterState
from central.supervisor import Supervisor
config_source = MockConfigSource()
initial_config = AdapterConfig(