Skip to content

chore: add a zc fixture and service info helper to dry up the tests - #1870

Merged
bdraco merged 1 commit into
masterfrom
dry_up_tests
Aug 29, 2026
Merged

bdraco merged 1 commit into
masterfrom
dry_up_tests

Conversation

@bdraco

@bdraco bdraco commented Aug 29, 2026

Copy link
Copy Markdown
Member

Summary

Code cleanup, not related to #1835; the duplication just became obvious while doing the audits. Two pieces of shared infrastructure and the heaviest call sites converted:

  • a zc pytest fixture in conftest that yields a running Zeroconf bound to loopback and closes it after the test; eighteen tests in test_handlers drop their hand rolled construct and close boilerplate, and the one remaining unittest class there is converted to bare functions
  • a make_service_info helper in the tests package carrying the suite's canonical fixture values; twenty seven canonical eight line ServiceInfo constructions across six files collapse to one line each, with genuine variants left explicit

Net minus 253 lines. Remaining files can adopt the fixture and helper incrementally.

Test plan

  • full suite passes

@github-actions

Copy link
Copy Markdown

Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, see #1835.

By continuing with this pull request you are okay with your contribution, and your previous contributions to this repository, being offered under Apache 2.0.

If that does not work for you, no hard feelings; reply with the exact phrase I do not agree to the Apache 2.0 license or simply close this pull request, and nothing of yours will be included in the change.

@bdraco
bdraco marked this pull request as ready for review August 29, 2026 21:57
@codecov

codecov Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (4307523) to head (a150cb0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1870   +/-   ##
=======================================
  Coverage   99.87%   99.87%           
=======================================
  Files          33       33           
  Lines        3882     3882           
  Branches      567      567           
=======================================
  Hits         3877     3877           
  Misses          3        3           
  Partials        2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bdraco
bdraco merged commit e6e0a60 into master Aug 29, 2026
36 checks passed
@bdraco
bdraco deleted the dry_up_tests branch August 29, 2026 22:00
@codspeed

codspeed Bot commented Aug 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing dry_up_tests (a150cb0) with master (4307523)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant