fix lint and formatting violations in tests and source

This commit is contained in:
Username
2026-02-24 16:50:51 +01:00
parent 0f476a25d5
commit 85f373a8b5
5 changed files with 62 additions and 62 deletions

View File

@@ -2,7 +2,7 @@
import threading
from tuimble.reconnect import INITIAL_DELAY, MAX_RETRIES, ReconnectManager
from tuimble.reconnect import INITIAL_DELAY, ReconnectManager
def _make_manager(connect_fn=None, **overrides):
@@ -22,7 +22,9 @@ def _make_manager(connect_fn=None, **overrides):
log["exhausted"] += 1
if connect_fn is None:
connect_fn = lambda: None
def connect_fn():
return None
mgr = ReconnectManager(
connect_fn=connect_fn,
@@ -67,6 +69,7 @@ def test_success_after_failures():
mgr, log = _make_manager(connect_fn=flaky_connect)
# Patch delay to zero for test speed
import tuimble.reconnect as mod
orig = mod.INITIAL_DELAY
mod.INITIAL_DELAY = 0
try:
@@ -88,7 +91,10 @@ def test_non_retryable_aborts_immediately():
class Rejected(Exception):
retryable = False
mgr, log = _make_manager(connect_fn=lambda: (_ for _ in ()).throw(Rejected("banned")))
def _raise():
raise Rejected("banned")
mgr, log = _make_manager(connect_fn=_raise)
mgr.run()
assert log["exhausted"] == 1
assert log["success"] == 0
@@ -102,6 +108,7 @@ def test_non_retryable_aborts_immediately():
def test_exhaustion_after_max_retries():
"""Loop stops after MAX_RETRIES failed attempts."""
import tuimble.reconnect as mod
orig_delay = mod.INITIAL_DELAY
orig_retries = mod.MAX_RETRIES
mod.INITIAL_DELAY = 0
@@ -155,6 +162,7 @@ def test_backoff_delays():
# We only need the attempt callback to record delays; cancel after
# a few attempts to avoid waiting.
import tuimble.reconnect as mod
orig_delay = mod.INITIAL_DELAY
orig_retries = mod.MAX_RETRIES
mod.INITIAL_DELAY = 0 # zero delay for speed