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:
@@ -772,7 +772,7 @@ async def test_attempt_observe_mode_discards_stale_commit_after_session_swap(
|
||||
other = FakeObserveSession()
|
||||
|
||||
def _swap_session_mid_wait(subscribed, grace_period_s, success_fraction=None):
|
||||
coordinator._session = other
|
||||
coordinator._session = other # ty: ignore[invalid-assignment]
|
||||
return True
|
||||
|
||||
with patch.object(
|
||||
|
||||
Reference in New Issue
Block a user