Skip to content

Remove stale xfail in hdmi_cec switch status test - #180532

Merged
frenck merged 1 commit into
home-assistant:devfrom
Kjubikstronk:hdmi-cec-stale-xfail
Aug 29, 2026
Merged

frenck merged 1 commit into
home-assistant:devfrom
Kjubikstronk:hdmi-cec-stale-xfail

Conversation

@Kjubikstronk

@Kjubikstronk Kjubikstronk commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed change

test_device_status_change in the hdmi_cec switch tests guards six of its
sixteen parameter sets with the imperative pytest.xfail():

state = hass.states.get("switch.hdmi_3")
if power_status in (POWER_ON, 4) and status is not None:
    pytest.xfail(reason="`CecSwitchEntity.is_on` returns `False` here instead of `true` as expected.")
assert state.state == expected_state

The imperative form aborts the test on the spot, so the assertion below it
never runs. Unlike pytest.mark.xfail it cannot report XPASS, which means it
keeps reporting xfailed whether or not the bug is still there.

The bug is gone. It was fixed by the async migration in #168306, which turned
CecSwitchEntity.update into async_update. That same PR removed two
pytest.mark.xfail markers from test_media_player.py because they started
passing and showed up as XPASS. This one was left behind because it never
could.

Removing the guard lets all sixteen parameter sets assert, and they all pass.

Only one other imperative pytest.xfail() exists in the test suite,
in tests/pylint/test_determinism.py, where it is the intended behaviour of a
self-test. So this is the only stale one.

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:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

pytest tests/components/hdmi_cec/ before this change: 102 passed, 23 xfailed.
After: 108 passed, 17 xfailed, no failures. Stable across repeated randomised
runs.

Checklist

  • I understand the code I am submitting and can explain how it works.
  • 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 Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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 diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

test_device_status_change used the imperative pytest.xfail(), which aborts
the test before the assertion instead of running it and reporting XPASS.
The underlying bug was fixed by the async migration in #168306, which
removed the two equivalent markers from test_media_player.py because they
started passing. This one stayed because it can never report a pass.

All 16 parameter sets pass with the guard removed.
Copilot AI balanced review requested due to automatic review settings August 28, 2026 17:15

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Kjubikstronk

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
home-assistant Bot marked this pull request as draft August 28, 2026 17:15
@home-assistant

Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant

Copy link
Copy Markdown
Contributor

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

Code owner commands

Code owners of hdmi_cec can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign hdmi_cec Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes a stale imperative xfail so all switch status cases execute their assertions.

Changes:

  • Removes the obsolete conditional pytest.xfail.
  • Enables six previously skipped parameter sets.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

" instead of `true` as expected."
)
)
assert state.state == expected_state
@Kjubikstronk
Kjubikstronk marked this pull request as ready for review August 28, 2026 19:08

@frenck frenck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, @Kjubikstronk 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck
frenck merged commit 790cada into home-assistant:dev Aug 29, 2026
35 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 30, 2026
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.

3 participants