test: suppress ty's invalid-assignment on the fake-session swap

coordinator is explicitly typed as LocalThingsCoordinator here, so ty
correctly sees _session's declared type (DtlsCoapSession | None) and
flags assigning a FakeObserveSession to it. The fixture's own
_connect_session replacement does the same swap without tripping ty,
but only because its self parameter is unannotated -- ty has nothing to
check the assignment against there. Deliberate here (this is the whole
point of the test: substitute a stand-in session), so silenced rather
than restructured; ty's --add-ignore confirmed the comment syntax
(ty: ignore[...], not the mypy-style type: ignore[...] used elsewhere
in this suite, which ty doesn't appear to honor for this rule).
This commit is contained in:
Marc Billow
2026-08-06 02:07:39 +00:00
parent a3cc918343
commit e3e7f4f43c
+1 -1
View File
@@ -772,7 +772,7 @@ async def test_attempt_observe_mode_discards_stale_commit_after_session_swap(
other = FakeObserveSession() other = FakeObserveSession()
def _swap_session_mid_wait(subscribed, grace_period_s, success_fraction=None): def _swap_session_mid_wait(subscribed, grace_period_s, success_fraction=None):
coordinator._session = other coordinator._session = other # ty: ignore[invalid-assignment]
return True return True
with patch.object( with patch.object(