Skip to content

Fix songpal test_setup_failed test#95712

Merged
rytilahti merged 1 commit into
home-assistant:devfrom
jbouwh:songpal-fix-test_setup_failed-test
Jul 2, 2023
Merged

Fix songpal test_setup_failed test#95712
rytilahti merged 1 commit into
home-assistant:devfrom
jbouwh:songpal-fix-test_setup_failed-test

Conversation

@jbouwh
Copy link
Copy Markdown
Contributor

@jbouwh jbouwh commented Jul 2, 2023

Proposed change

Improve songpal test_setup_failed test. It now counts the number of warings in the test, but that can lead to false positives.

Fixes: FAILED tests/components/songpal/test_media_player.py::test_setup_failed - assert 3 == 2

Example logging when this gets wrong and logs 3 warings failing the test.

----------------------------- Captured stderr call ----------------------------- 
WARNING:asyncio:Executing <Task pending name='Task-53151' coro=<test_setup_failed() running at /home/runner/work/core/core/tests/components/songpal/test_media_player.py:102> wait_for=<Task pending name='setup component songpal' coro=<_async_setup_component() running at /home/runner/work/core/core/homeassistant/setup.py:168> cb=[set.remove(), Task.task_wakeup()] created at /home/runner/work/core/core/homeassistant/core.py:552> cb=[_run_until_complete_cb() at /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/base_events.py:184] created at /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/asyncio/tasks.py:636> took 0.107 seconds 
INFO:homeassistant.loader:Loaded songpal from homeassistant.components.songpal 
INFO:homeassistant.setup:Setting up songpal 
INFO:homeassistant.setup:Setup of domain songpal took 0.0 seconds 
INFO:homeassistant.loader:Loaded media_player from homeassistant.components.media_player 
INFO:homeassistant.loader:Loaded http from homeassistant.components.http 
DEBUG:homeassistant.setup:Dependency media_player will wait for dependencies ['http'] 
INFO:homeassistant.setup:Setting up http 
DEBUG:tests.common:Writing data to http.auth: {'version': 1, 'minor_version': 1, 'key': 'http.auth', 'data': {'content_user': '127eb3dc55ba41608a71a4c45cceccb2'}} 
DEBUG:homeassistant.components.network.network:Adapters: [{'name': 'eth0', 'index': 0, 'enabled': True, 'auto': True, 'default': True, 'ipv4': [{'address': '10.10.10.10', 'network_prefix': 24}], 'ipv6': []}] 
INFO:homeassistant.setup:Setup of domain http took 0.0 seconds 
DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http> 
INFO:homeassistant.setup:Setting up media_player 
INFO:homeassistant.setup:Setup of domain media_player took 0.0 seconds 
DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=media_player> 
DEBUG:homeassistant.helpers.translation:Cache miss for en: media_player 
DEBUG:homeassistant.helpers.translation:Cache miss for en: songpal 
INFO:homeassistant.components.media_player:Setting up media_player.songpal 
WARNING:homeassistant.components.songpal.media_player:[name(http://0.0.0.0:10000/sony)] Unable to connect 
DEBUG:homeassistant.components.songpal.media_player:Unable to get methods from songpal: Unable to do POST request: : None 
WARNING:homeassistant.components.media_player:Platform songpal not ready yet: Unable to do POST request: : None; Retrying in background in 30 seconds 
DEBUG:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=songpal>

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)
  • Deprecation (breaking change to happen in the future)
  • 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
  • I have followed the perfect PR recommendations
  • 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.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

home-assistant Bot commented Jul 2, 2023

Hey there @rytilahti, @shenxn, mind taking a look at this pull request as it has been labeled with an integration (songpal) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of songpal can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign songpal Removes the current integration label and assignees on the pull request, add the integration domain after the command.

Copy link
Copy Markdown
Member

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jbouwh!

@rytilahti rytilahti merged commit b314e2b into home-assistant:dev Jul 2, 2023
@jbouwh jbouwh deleted the songpal-fix-test_setup_failed-test branch July 2, 2023 15:06
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants