What
tests/test_device_sync.py is 5953 lines, 294 test functions, and zero uses of @pytest.mark.parametrize.
Most of those 294 are genuinely distinct scenarios — the module under test is the most complex in the plugin (3792 lines of reconciliation logic) and earns dense coverage. This issue is not "collapse the suite".
It is about a specific, repeating shape: mirror-image pairs that differ only in which sibling device a reading should land on. For example:
test_flow_update_goes_to_flow_device_not_pressure (:890)
test_pressure_update_goes_to_pressure_device_not_flow (:907)
Structurally identical — same ds.create_from_raw(PRESSURE_FLOW_NODE, ...) setup, same event-dispatch call — differing only in cluster id, attribute, value, and target device. The same pattern recurs across the air-quality tests (test_aq_*, 5 of them) and the pressure/flow cluster.
Why it matters
Low severity — this is maintenance cost, not a correctness gap. But with literally zero parametrize calls in a 294-test file there is no established convention to extend, so each new sibling-routing case gets copy-pasted too, and the file keeps growing at ~20 lines per case.
Fix
Convert the ~10-15 clearest mirror-pairs to @pytest.mark.parametrize. Cuts several hundred lines with no coverage loss, and establishes the convention for the next one.
Do this carefully and case by case — a pair that looks symmetric but is not (e.g. one side asserts an extra guard) must stay as two tests. If a conversion needs an if inside the test body, it was not a real pair.
Found
During the 2026-08-25 refactor review. Out of scope for that arc, banked here. Best done after #304 (which touches test structure in a different file) rather than alongside it.
What
tests/test_device_sync.pyis 5953 lines, 294 test functions, and zero uses of@pytest.mark.parametrize.Most of those 294 are genuinely distinct scenarios — the module under test is the most complex in the plugin (3792 lines of reconciliation logic) and earns dense coverage. This issue is not "collapse the suite".
It is about a specific, repeating shape: mirror-image pairs that differ only in which sibling device a reading should land on. For example:
test_flow_update_goes_to_flow_device_not_pressure(:890)test_pressure_update_goes_to_pressure_device_not_flow(:907)Structurally identical — same
ds.create_from_raw(PRESSURE_FLOW_NODE, ...)setup, same event-dispatch call — differing only in cluster id, attribute, value, and target device. The same pattern recurs across the air-quality tests (test_aq_*, 5 of them) and the pressure/flow cluster.Why it matters
Low severity — this is maintenance cost, not a correctness gap. But with literally zero parametrize calls in a 294-test file there is no established convention to extend, so each new sibling-routing case gets copy-pasted too, and the file keeps growing at ~20 lines per case.
Fix
Convert the ~10-15 clearest mirror-pairs to
@pytest.mark.parametrize. Cuts several hundred lines with no coverage loss, and establishes the convention for the next one.Do this carefully and case by case — a pair that looks symmetric but is not (e.g. one side asserts an extra guard) must stay as two tests. If a conversion needs an
ifinside the test body, it was not a real pair.Found
During the 2026-08-25 refactor review. Out of scope for that arc, banked here. Best done after #304 (which touches test structure in a different file) rather than alongside it.