Commit fafd420
committed
test: add quick_timing fixture and apply to register-heavy tests
Recent bump of _CHECK_TIME from 175ms to 500ms (made for RFC 6762
interop on slow WiFi / IoT networks) inflated every test that does
real probe/announce/unregister by ~1-2s. The production constants
are not needed for loopback tests — services register and answer
themselves over 127.0.0.1 with no contention.
Add an opt-in `quick_timing` fixture in tests/conftest.py that
patches `_core._CHECK_TIME`, `_core._REGISTER_TIME`, and
`_core._UNREGISTER_TIME` to 10ms each. Patching at the `_core`
module is required because these constants are pulled in via
`from .const import ...` at module load time, so patching
`const.*` does not affect the binding `_core` already holds.
Apply to seven of the worst-offending register-heavy tests, also
passing explicit `timeout=200` to the post-unregister
`async_get_service_info` calls and the patched-_is_complete
`async_request` call so they don't pay the default 3000ms.
Combined wall time across the seven tests drops from ~46s to
~7.5s:
test_shutdown_while_register_in_process 10.69s -> 0.40s
test_service_info_async_request 9.82s -> 0.7s
test_async_zeroconf_service_types 6.16s -> 4.3s
test_async_unregister_all_services 5.99s -> 0.52s
test_async_service_registration_same_server_same_ports 3.23s -> ~0.2s
test_async_service_registration_same_server_different_ports 3.18s -> ~0.2s
test_async_service_registration_name_strict_check 2.99s -> ~0.2s
The fixture is opt-in (not autouse) because a handful of tests
under tests/test_handlers.py (`test_response_aggregation_timings`,
`test_response_aggregation_timings_multiple`) assert against the
production timing constants and must not be patched.1 parent 72a0152 commit fafd420
3 files changed
Lines changed: 30 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
| 263 | + | |
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
| 330 | + | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| |||
468 | 468 | | |
469 | 469 | | |
470 | 470 | | |
471 | | - | |
| 471 | + | |
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| |||
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
608 | | - | |
| 608 | + | |
609 | 609 | | |
610 | 610 | | |
611 | 611 | | |
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
710 | | - | |
| 710 | + | |
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
827 | | - | |
| 827 | + | |
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | | - | |
874 | | - | |
| 873 | + | |
| 874 | + | |
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
| |||
883 | 883 | | |
884 | 884 | | |
885 | 885 | | |
886 | | - | |
| 886 | + | |
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
| 724 | + | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
| |||
0 commit comments