Problem
The get_default_ip() function is currently duplicated in multiple test files:
tests/test_hear_cleanup.py (lines 176-200)
tests/test_hear_server.py
This violates DRY principles and creates maintenance overhead.
Proposed Solution
Refactor the get_default_ip() function into a common location, with suggested targets:
tests.context module - Most appropriate for test utility functions
multicast.skt module - Alternative location if it fits better with socket utilities
Implementation Notes
- Remove duplicate implementations from individual test files
- Import the centralized function where needed
- Ensure consistent behavior across all usage points
- Update any related documentation
Context
This refactoring was identified during code review in PR #448. The function implements RFC 5737 compliant IP detection using TEST-NET-3 (203.0.113.1) and is well-designed but should not be duplicated.
References
Problem
The
get_default_ip()function is currently duplicated in multiple test files:tests/test_hear_cleanup.py(lines 176-200)tests/test_hear_server.pyThis violates DRY principles and creates maintenance overhead.
Proposed Solution
Refactor the
get_default_ip()function into a common location, with suggested targets:tests.contextmodule - Most appropriate for test utility functionsmulticast.sktmodule - Alternative location if it fits better with socket utilitiesImplementation Notes
Context
This refactoring was identified during code review in PR #448. The function implements RFC 5737 compliant IP detection using TEST-NET-3 (203.0.113.1) and is well-designed but should not be duplicated.
References