-
-
Notifications
You must be signed in to change notification settings - Fork 28.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent dlna_dmr from opening sockets in tests #57059
Prevent dlna_dmr from opening sockets in tests #57059
Conversation
Hey there @StevenLooman, @chishm, mind taking a look at this pull request as it has been labeled with an integration ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
@pytest.fixture(autouse=True) | ||
def dlna_dmr_mock_get_source_ip(mock_get_source_ip): | ||
"""Mock network util's async_get_source_ip.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dlna_dmr
component actually uses async_upnp_client.utils.async_get_local_ip
, not the hass version, for IPv6 support and an easier interface.
It is already mocked a few lines up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chishm dlna_dmr
lists network
as a requirement in its manifest, network
calls async_get_source_ip
during its setup. If this is not needed, network
should be removed from the requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see it got added during the transition to components.network.async_get_source_ip
by #52980, before I rewrote that part of dlna_dmr
.
I can remove network
from the manifest, but it's a transitory requirement via ssdp
. Does that mean the fixture is still required? If it is required, would it not be better to make the top-level fixture in tests/conftest.py
auto-use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If dlna_dmr
depends on ssdp
and ssdp
depends on network
, the fixture is still needed.
Most integrations don't depend - directly or indirectly - on network
, so I'm not sure we want to make it a top-level autouse fixture.
Supports #55516
Proposed change
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: