Skip to content
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

Merged
merged 1 commit into from
Oct 4, 2021

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 4, 2021

Supports #55516

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @StevenLooman, @chishm, mind taking a look at this pull request as it has been labeled with an integration (dlna_dmr) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Dev automation moved this from Needs review to Reviewer approved Oct 4, 2021
@MartinHjelmare MartinHjelmare merged commit 2f960e5 into home-assistant:dev Oct 4, 2021
Dev automation moved this from Reviewer approved to Done Oct 4, 2021

@pytest.fixture(autouse=True)
def dlna_dmr_mock_get_source_ip(mock_get_source_ip):
"""Mock network util's async_get_source_ip."""
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

@emontnemery emontnemery mentioned this pull request Oct 5, 2021
22 tasks
@chishm chishm mentioned this pull request Oct 6, 2021
22 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants