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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MQTT tests to use modern platform schema part 2 #77525

Merged
merged 14 commits into from
Sep 6, 2022

Conversation

jbouwh
Copy link
Contributor

@jbouwh jbouwh commented Aug 30, 2022

Proposed change

When the legacy schema is going to be removed with HA 2022.12.0 we need to update the tests to use the modern schema.
This PR will be the start of adopting the the modern schema.

The tests for the MQTT integration rely mainly on yaml the deprecated platform schema. For al platform tests a new DEFAULT_CONFIG will be defined, a clone without the platform attribute.
DEFAULT_CONFIG_LEGACY will hold the default config for the deprecated schema.
A new test will be added temporary to still test setup with the deprecated schema: test_setup_with_legacy_schema.
So all (common)tests that are not converted yet to the new schema will use DEFAULT_CONFIG_LEGACY config until the common code is migrated.
I'll use one commit per platform to begin with. Common tests will be updated later. Finally when the support for config under the platform key is removed all tests referring to the old schema will be labeled with deprecation comment.

This is a follow up for #77387

A PR for the common tests can be found here: #77583

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
  • 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 @emontnemery, mind taking a look at this pull request as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jbouwh jbouwh force-pushed the mqttt-tests-modern-yaml2 branch 2 times, most recently from 6391102 to 3872142 Compare August 30, 2022 19:43
@jbouwh jbouwh marked this pull request as ready for review August 30, 2022 19:45
@jbouwh jbouwh added code-quality and removed small-pr PRs with less than 30 lines. labels Aug 30, 2022
@jbouwh jbouwh force-pushed the mqttt-tests-modern-yaml2 branch from 417bb15 to cc0dcbf Compare September 3, 2022 07:45
tests/components/mqtt/test_light.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_light.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_light_json.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_light.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_light_json.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_siren.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_state_vacuum.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_state_vacuum.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_switch.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_switch.py Outdated Show resolved Hide resolved
@jbouwh jbouwh merged commit 13188a5 into home-assistant:dev Sep 6, 2022
@jbouwh jbouwh deleted the mqttt-tests-modern-yaml2 branch September 6, 2022 09:03
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2022
@jbouwh jbouwh added this to the 2022.9.6 milestone Sep 19, 2022
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.

4 participants