Skip to content

Refactor Vizio tests: shared fixtures, snapshot_platform, reduced parametrize#167935

Merged
joostlek merged 5 commits intohome-assistant:devfrom
raman325:vizio-test-refactor
Apr 10, 2026
Merged

Refactor Vizio tests: shared fixtures, snapshot_platform, reduced parametrize#167935
joostlek merged 5 commits intohome-assistant:devfrom
raman325:vizio-test-refactor

Conversation

@raman325
Copy link
Copy Markdown
Contributor

@raman325 raman325 commented Apr 10, 2026

Proposed change

Refactors Vizio integration tests to address review comments from #165820:

  • Shared fixtures in conftest: Added mock_tv_config_entry and mock_speaker_config_entry fixtures plus a setup_integration helper, eliminating duplicated MockConfigEntry creation across test_remote.py, test_media_player.py, and test_init.py
  • snapshot_platform: Added snapshot-based entity setup tests for both remote and media_player platforms, capturing complete entity state + registry entries instead of manual 2-3 field assertions
  • Reduced parametrize lists: Trimmed exhaustive command lists in remote tests to representative subsets (TV valid 5→3, speaker valid 10→3, speaker invalid 4→3) while retaining case-insensitivity coverage

Type of change

  • Code quality improvements to existing code or addition of tests

Additional information

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.

To help with the load of incoming pull requests:

raman325 and others added 5 commits April 10, 2026 15:10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… reduce parametrize

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…d snapshot_platform

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Vizio integration test suite to reduce duplication and improve coverage/readability by centralizing config-entry setup and using snapshot-based entity assertions.

Changes:

  • Added shared MockConfigEntry fixtures and a setup_integration helper in tests/components/vizio/conftest.py.
  • Introduced snapshot-based entity setup tests for the remote and media_player platforms (with platform-limiting fixtures to satisfy snapshot_platform constraints).
  • Simplified/trimmed remote command parametrization while preserving representative and case-insensitivity coverage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/components/vizio/conftest.py Adds shared TV/speaker config entry fixtures and a helper to set up the integration consistently.
tests/components/vizio/test_remote.py Uses shared fixtures/helper; adds snapshot-based setup test and limits loaded platforms to remote for snapshots.
tests/components/vizio/test_media_player.py Uses shared fixtures/helper; adds snapshot-based setup test and limits loaded platforms to media_player for snapshots.
tests/components/vizio/test_init.py Refactors setup to use shared helper/fixtures, keeping existing assertions intact.
tests/components/vizio/snapshots/test_remote.ambr Adds snapshots for remote entity registry entry + state.
tests/components/vizio/snapshots/test_media_player.ambr Adds snapshots for media_player entity registry entry + state.

@joostlek joostlek merged commit 53ed4b2 into home-assistant:dev Apr 10, 2026
37 checks passed
@raman325 raman325 deleted the vizio-test-refactor branch April 10, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants